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 BE339A0547; Mon, 19 Jul 2021 15:09:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B5D2F410F4; Mon, 19 Jul 2021 15:09:31 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id E0F8A4068B for ; Mon, 19 Jul 2021 15:09:29 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10049"; a="296612997" X-IronPort-AV: E=Sophos;i="5.84,252,1620716400"; d="scan'208";a="296612997" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2021 06:07:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,252,1620716400"; d="scan'208";a="494057159" Received: from bdcdev11.iind.intel.com ([10.190.193.151]) by fmsmga004.fm.intel.com with ESMTP; 19 Jul 2021 06:07:09 -0700 From: Churchill Khangar To: dts@dpdk.org Cc: venkata.suresh.kumar.p@intel.com, churchill.khangar@intel.com, yogesh.jangra@intel.com Date: Mon, 19 Jul 2021 09:00:08 -0400 Message-Id: <1626699608-20895-3-git-send-email-churchill.khangar@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1626699608-20895-1-git-send-email-churchill.khangar@intel.com> References: <1626699608-20895-1-git-send-email-churchill.khangar@intel.com> Subject: [dts] [PATCH 2/2] tests/pipeline: add LPM and action selector test suite 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 Sender: "dts" This patch has the pipeline test suite changes to cover the scenarios on Longest Prefix Match(LPM) and action selector features. Signed-off-by: Churchill Khangar Tested-by: Venkata Suresh Kumar P --- tests/TestSuite_pipeline.py | 391 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 326 insertions(+), 65 deletions(-) diff --git a/tests/TestSuite_pipeline.py b/tests/TestSuite_pipeline.py index 2b14ddf..e00f2e9 100644 --- a/tests/TestSuite_pipeline.py +++ b/tests/TestSuite_pipeline.py @@ -250,6 +250,36 @@ class TestPipeline(TestCase): self.dut.send_expect('^C', '# ') self.verify(False, "Output pcap files mismatch error") + def send_scapy_pkts(self, from_port): + + tx_port = self.tester.get_local_port(self.dut_ports[from_port]) + tx_interface = self.tester.get_interface(tx_port) + + self.tester.send_expect('rm -f /tmp/*.txt /tmp/*.pcap /tmp/*.out', '# ') + pcap_file = '/tmp/packet_tx.pcap' + self.tester.scapy_foreground() + pr = 0 + for a in range(192, 255): + for b in range(0, 255): + for c in range(0, 255): + for d in range(0, 255): + my_dst = "{}.{}.{}.{}".format(a, b, c, d) + pkt = [Ether(dst=self.dut_p0_mac)/IP(src="0.0.0.2", dst=my_dst) / + TCP(sport=100, dport=200)/Raw(load="X"*6)] + wrpcap(pcap_file, pkt, append=True) + pr += 1 + if pr == 50: + pr = 0 + self.tester.scapy_append('pkt = rdpcap("/tmp/packet_tx.pcap")') + self.tester.scapy_append('sendp(pkt, iface="{}", count=1)'.format(tx_interface)) + self.tester.scapy_execute() + self.tester.send_expect('rm -f /tmp/*.txt /tmp/*.pcap /tmp/*.out', '# ') + + if pr: + self.tester.scapy_append('pkt = rdpcap("/tmp/packet_tx.pcap")') + self.tester.scapy_append('sendp(pkt, iface="{}", count=1)'.format(tx_interface)) + self.tester.scapy_execute() + def setup_env(self, port_nums, driver): """ This is to set up vf environment. @@ -2566,71 +2596,6 @@ class TestPipeline(TestCase): self.send_and_sniff_multiple(tx_port, rx_port, in_pcap, out_pcap, filters) self.dut.send_expect("^C", "# ", 20) - def test_table_005(self): - - cli_file = '/tmp/pipeline/table_005/table_005.cli' - self.run_dpdk_app(cli_file) - sleep(1) - s = self.connect_cli_server() - - # [1]: Empty table: Default action executed for all the packets. - in_pcap = 'pipeline/table_005/pcap_files/in_1.txt' - out_pcap = 'pipeline/table_005/pcap_files/out_1.txt' - self.send_and_sniff_pkts(0, 0, in_pcap, out_pcap, "tcp") - - # [2]: Single rule: Defined action for hit, Default action for miss. - CMD_FILE = '/tmp/pipeline/table_005/cmd_files/cmd_2.txt' - CLI_CMD = 'pipeline PIPELINE0 table table_005_table add {}\n'.format(CMD_FILE) - self.socket_send_cmd(s, CLI_CMD, "pipeline> ") - CLI_CMD = 'pipeline PIPELINE0 commit\n' - self.socket_send_cmd(s, CLI_CMD, "pipeline> ") - in_pcap = 'pipeline/table_005/pcap_files/in_2.txt' - out_pcap = 'pipeline/table_005/pcap_files/out_2.txt' - self.send_and_sniff_pkts(1, 1, in_pcap, out_pcap, "tcp") - - # [3]: Two rules scenario. Appropriate action for hit. - CMD_FILE = '/tmp/pipeline/table_005/cmd_files/cmd_3.txt' - CLI_CMD = 'pipeline PIPELINE0 table table_005_table add {}\n'.format(CMD_FILE) - self.socket_send_cmd(s, CLI_CMD, "pipeline> ") - CLI_CMD = 'pipeline PIPELINE0 commit\n' - self.socket_send_cmd(s, CLI_CMD, "pipeline> ") - in_pcap = 'pipeline/table_005/pcap_files/in_3.txt' - out_pcap = 'pipeline/table_005/pcap_files/out_3.txt' - self.send_and_sniff_pkts(2, 2, in_pcap, out_pcap, "tcp") - - # [4]: Action update scenario. Updated action(s) for hit. - CMD_FILE = '/tmp/pipeline/table_005/cmd_files/cmd_4.txt' - CLI_CMD = 'pipeline PIPELINE0 table table_005_table add {}\n'.format(CMD_FILE) - self.socket_send_cmd(s, CLI_CMD, "pipeline> ") - CLI_CMD = 'pipeline PIPELINE0 commit\n' - self.socket_send_cmd(s, CLI_CMD, "pipeline> ") - in_pcap = 'pipeline/table_005/pcap_files/in_4.txt' - out_pcap = 'pipeline/table_005/pcap_files/out_4.txt' - self.send_and_sniff_pkts(3, 2, in_pcap, out_pcap, "tcp") - - # [5]: Delete one rule. Default action for packet corresponding to deleted rule. - CMD_FILE = '/tmp/pipeline/table_005/cmd_files/cmd_5.txt' - CLI_CMD = 'pipeline PIPELINE0 table table_005_table delete {}\n'.format(CMD_FILE) - self.socket_send_cmd(s, CLI_CMD, "pipeline> ") - CLI_CMD = 'pipeline PIPELINE0 commit\n' - self.socket_send_cmd(s, CLI_CMD, "pipeline> ") - in_pcap = 'pipeline/table_005/pcap_files/in_5.txt' - out_pcap = 'pipeline/table_005/pcap_files/out_5.txt' - self.send_and_sniff_pkts(0, 1, in_pcap, out_pcap, "tcp") - - # [6]: Delete remaining rule. Default action executed for all the packets. - CMD_FILE = '/tmp/pipeline/table_005/cmd_files/cmd_6.txt' - CLI_CMD = 'pipeline PIPELINE0 table table_005_table delete {}\n'.format(CMD_FILE) - self.socket_send_cmd(s, CLI_CMD, "pipeline> ") - CLI_CMD = 'pipeline PIPELINE0 commit\n' - self.socket_send_cmd(s, CLI_CMD, "pipeline> ") - in_pcap = 'pipeline/table_005/pcap_files/in_6.txt' - out_pcap = 'pipeline/table_005/pcap_files/out_6.txt' - self.send_and_sniff_pkts(1, 0, in_pcap, out_pcap, "tcp") - - s.close() - self.dut.send_expect("^C", "# ", 20) - def test_reg_001(self): cli_file = '/tmp/pipeline/reg_001/reg_001.cli' @@ -4623,6 +4588,302 @@ class TestPipeline(TestCase): self.send_and_sniff_multiple(tx_port, rx_port, in_pcap, out_pcap, filters) self.dut.send_expect("^C", "# ", 20) + def test_lpm_001(self): + + cli_file = '/tmp/pipeline/lpm_001/lpm_001.cli' + self.run_dpdk_app(cli_file) + sleep(1) + s = self.connect_cli_server() + + # [1]: Empty table: Default action executed for all the packets. + in_pcap = 'pipeline/lpm_001/pcap_files/in_1.txt' + out_pcap = 'pipeline/lpm_001/pcap_files/out_1.txt' + self.send_and_sniff_pkts(0, 0, in_pcap, out_pcap, "tcp") + + # [2]: Single rule: Defined action for hit, Default action for miss. + CMD_FILE = '/tmp/pipeline/lpm_001/cmd_files/cmd_2.txt' + CLI_CMD = 'pipeline PIPELINE0 table lpm_001_table add {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = 'pipeline/lpm_001/pcap_files/in_2.txt' + out_pcap = 'pipeline/lpm_001/pcap_files/out_2.txt' + self.send_and_sniff_pkts(1, 1, in_pcap, out_pcap, "tcp") + + # [3]: Two rules scenario. Appropriate action for hit. + CMD_FILE = '/tmp/pipeline/lpm_001/cmd_files/cmd_3.txt' + CLI_CMD = 'pipeline PIPELINE0 table lpm_001_table add {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = 'pipeline/lpm_001/pcap_files/in_3.txt' + out_pcap = 'pipeline/lpm_001/pcap_files/out_3.txt' + self.send_and_sniff_pkts(2, 2, in_pcap, out_pcap, "tcp") + + # [4]: Action update scenario. Updated action(s) for hit. + CMD_FILE = '/tmp/pipeline/lpm_001/cmd_files/cmd_4.txt' + CLI_CMD = 'pipeline PIPELINE0 table lpm_001_table add {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = 'pipeline/lpm_001/pcap_files/in_4.txt' + out_pcap = 'pipeline/lpm_001/pcap_files/out_4.txt' + self.send_and_sniff_pkts(3, 2, in_pcap, out_pcap, "tcp") + + # [5]: Delete one rule. Default action for packet corresponding to deleted rule. + CMD_FILE = '/tmp/pipeline/lpm_001/cmd_files/cmd_5.txt' + CLI_CMD = 'pipeline PIPELINE0 table lpm_001_table delete {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = 'pipeline/lpm_001/pcap_files/in_5.txt' + out_pcap = 'pipeline/lpm_001/pcap_files/out_5.txt' + self.send_and_sniff_pkts(0, 1, in_pcap, out_pcap, "tcp") + + # [6]: Delete remaining rule. Default action executed for all the packets. + CMD_FILE = '/tmp/pipeline/lpm_001/cmd_files/cmd_6.txt' + CLI_CMD = 'pipeline PIPELINE0 table lpm_001_table delete {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = 'pipeline/lpm_001/pcap_files/in_6.txt' + out_pcap = 'pipeline/lpm_001/pcap_files/out_6.txt' + self.send_and_sniff_pkts(1, 0, in_pcap, out_pcap, "tcp") + + s.close() + self.dut.send_expect("^C", "# ", 20) + + def test_lpm_002(self): + + cli_file = '/tmp/pipeline/lpm_002/lpm_002.cli' + self.run_dpdk_app(cli_file) + sleep(1) + s = self.connect_cli_server() + + # [1] Input packets on ports 0 .. 3: + # IPv4 dest_addr has all bits randomized (mask is 0.0.0.0) + # Expected output packet distribution on ports 0 .. 3: + # Port 0 = 25%; Port 1 = 25%; Port 2 = 25%; Port 3 = 25% + in_pcap = ['pipeline/lpm_002/pcap_files/in_1.txt'] + out_pcap_1 = 'pipeline/lpm_002/pcap_files/out_11.txt' + out_pcap_2 = 'pipeline/lpm_002/pcap_files/out_12.txt' + out_pcap_3 = 'pipeline/lpm_002/pcap_files/out_13.txt' + out_pcap_4 = 'pipeline/lpm_002/pcap_files/out_14.txt' + out_pcap = [out_pcap_1, out_pcap_2, out_pcap_3, out_pcap_4] + filters = ["tcp"] * 4 + tx_port = [0] + rx_port = [0, 1, 2, 3] + self.send_and_sniff_multiple(tx_port, rx_port, in_pcap, out_pcap, filters) + + # [2] Input packets on ports 0 .. 3: + # IPv4 dest_addr has all bits randomized (mask is 0.0.0.0) + # Expected output packet distribution on ports 0 .. 3: + # Port 0 = 50%; Port 1 = 25%; Port 2 = 12.5%; Port 3 = 12.5% + CMD_FILE = '/tmp/pipeline/lpm_002/cmd_files/cmd_1.txt' + CLI_CMD = 'pipeline PIPELINE0 table lpm_002_table delete {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CMD_FILE = '/tmp/pipeline/lpm_002/cmd_files/cmd_2.txt' + CLI_CMD = 'pipeline PIPELINE0 table lpm_002_table add {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = ['pipeline/lpm_002/pcap_files/in_2.txt'] + out_pcap_1 = 'pipeline/lpm_002/pcap_files/out_21.txt' + out_pcap_2 = 'pipeline/lpm_002/pcap_files/out_22.txt' + out_pcap_3 = 'pipeline/lpm_002/pcap_files/out_23.txt' + out_pcap_4 = 'pipeline/lpm_002/pcap_files/out_24.txt' + out_pcap = [out_pcap_1, out_pcap_2, out_pcap_3, out_pcap_4] + self.send_and_sniff_multiple(tx_port, rx_port, in_pcap, out_pcap, filters) + + s.close() + self.dut.send_expect("^C", "# ", 20) + + def test_lpm_003(self): + + cli_file = '/tmp/pipeline/lpm_003/lpm_003.cli' + self.run_dpdk_app(cli_file) + + # Input packets on ports 0 .. 3: + # IPv4 dest_addr has all bits randomized (mask is 0.0.0.0) + # Expected output packet distribution on ports 0 .. 3: + # Port 0 = 12.5% + 25% = 37.5% (i.e. 3/8 = 6/16) + # Port 1 = 12.5% + 12.5% = 25% (i.e. 1/4 = 4/16) + # Port 2 = 12.5% + 6.25% = 18.75% (i.e. 3/16) + # Port 3 = 12.5% + 6.25% = 18.75% (i.e. 3/16) + in_pcap = ['pipeline/lpm_003/pcap_files/in_1.txt'] + out_pcap_1 = 'pipeline/lpm_003/pcap_files/out_11.txt' + out_pcap_2 = 'pipeline/lpm_003/pcap_files/out_12.txt' + out_pcap_3 = 'pipeline/lpm_003/pcap_files/out_13.txt' + out_pcap_4 = 'pipeline/lpm_003/pcap_files/out_14.txt' + out_pcap = [out_pcap_1, out_pcap_2, out_pcap_3, out_pcap_4] + filters = ["tcp"] * 4 + tx_port = [0] + rx_port = [0, 1, 2, 3] + self.send_and_sniff_multiple(tx_port, rx_port, in_pcap, out_pcap, filters) + self.dut.send_expect("^C", "# ", 20) + + def test_lpm_004(self): + + cli_file = '/tmp/pipeline/lpm_004/lpm_004.cli' + self.run_dpdk_app(cli_file) + + # Input packets on ports 0 .. 3: + # IPv4 dest_addr has all bits randomized (mask is 0.0.0.0) + # Expected output packet distribution on ports 0 .. 3: + # Port 0 = 25%; Port 1 = 25%; Port 2 = 37.5%; Port 3 = 12.5% + in_pcap = ['pipeline/lpm_004/pcap_files/in_1.txt'] + out_pcap_1 = 'pipeline/lpm_004/pcap_files/out_11.txt' + out_pcap_2 = 'pipeline/lpm_004/pcap_files/out_12.txt' + out_pcap_3 = 'pipeline/lpm_004/pcap_files/out_13.txt' + out_pcap_4 = 'pipeline/lpm_004/pcap_files/out_14.txt' + out_pcap = [out_pcap_1, out_pcap_2, out_pcap_3, out_pcap_4] + filters = ["tcp"] * 4 + tx_port = [0] + rx_port = [0, 1, 2, 3] + self.send_and_sniff_multiple(tx_port, rx_port, in_pcap, out_pcap, filters) + self.dut.send_expect("^C", "# ", 20) + + def test_selector_001(self): + + # ----- Selector table feature validation ----- + cli_file = '/tmp/pipeline/selector_001/selector_001.cli' + self.run_dpdk_app(cli_file) + sleep(1) + s = self.connect_cli_server() + + # [1]: Absence of Group + # Member 0 should act as the default member for each group. + in_pcap = 'pipeline/selector_001/pcap_files/in_1.txt' + out_pcap = 'pipeline/selector_001/pcap_files/out_1.txt' + self.send_and_sniff_pkts(1, 0, in_pcap, out_pcap, "tcp") + + # [2]: Allocate a group [Group ID: 0] + # All packets of this group should use this member. + CLI_CMD = 'pipeline PIPELINE0 selector selector_001 group add\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = 'pipeline/selector_001/pcap_files/in_2.txt' + out_pcap = 'pipeline/selector_001/pcap_files/out_2.txt' + self.send_and_sniff_pkts(1, 0, in_pcap, out_pcap, "tcp") + + # [3]: Add one member [Member ID: 1, Weight: 1] to Group 0 + # All packets of this group should use this member. + CMD_FILE = '/tmp/pipeline/selector_001/cmd_files/cmd_3.txt' + CLI_CMD = 'pipeline PIPELINE0 selector selector_001 group member add {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = 'pipeline/selector_001/pcap_files/in_3.txt' + out_pcap = 'pipeline/selector_001/pcap_files/out_3.txt' + self.send_and_sniff_pkts(0, 1, in_pcap, out_pcap, "tcp") + + # [4]: Add a new member [Member ID: 0, Weight: 1] to Group 0 + # Packets of this group should use members according to weights. [50:50] + CMD_FILE = '/tmp/pipeline/selector_001/cmd_files/cmd_4.txt' + CLI_CMD = 'pipeline PIPELINE0 selector selector_001 group member add {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = ['pipeline/selector_001/pcap_files/in_4.txt'] + out_pcap_1 = 'pipeline/selector_001/pcap_files/out_41.txt' + out_pcap_2 = 'pipeline/selector_001/pcap_files/out_42.txt' + out_pcap = [out_pcap_1, out_pcap_2] + filters = ["tcp"] * 2 + tx_port = [0] + rx_port = [0, 1] + self.send_and_sniff_multiple(tx_port, rx_port, in_pcap, out_pcap, filters) + + # [5]: Add a new member [Member ID: 2, Weight: 2] to Group 0 + # Packets of this group should use members according to weights. [25:25:50] + CMD_FILE = '/tmp/pipeline/selector_001/cmd_files/cmd_5.txt' + CLI_CMD = 'pipeline PIPELINE0 selector selector_001 group member add {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = ['pipeline/selector_001/pcap_files/in_5.txt'] + out_pcap_1 = 'pipeline/selector_001/pcap_files/out_51.txt' + out_pcap_2 = 'pipeline/selector_001/pcap_files/out_52.txt' + out_pcap_3 = 'pipeline/selector_001/pcap_files/out_53.txt' + out_pcap = [out_pcap_1, out_pcap_2, out_pcap_3] + filters = ["tcp"] * 3 + tx_port = [0] + rx_port = [0, 1, 2] + self.send_and_sniff_multiple(tx_port, rx_port, in_pcap, out_pcap, filters) + + # [6]: Add a new group [Group ID: 1] & add 4 members to it. + # [Member IDs: 0, 1, 2, 3; Weights: 1, 1, 2, 4] [12.5% : 12.5% : 25% : 50%] + # Packets of this group should use members according to weights. + CLI_CMD = 'pipeline PIPELINE0 selector selector_001 group add\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CMD_FILE = '/tmp/pipeline/selector_001/cmd_files/cmd_6.txt' + CLI_CMD = 'pipeline PIPELINE0 selector selector_001 group member add {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = ['pipeline/selector_001/pcap_files/in_6.txt'] + out_pcap_1 = 'pipeline/selector_001/pcap_files/out_61.txt' + out_pcap_2 = 'pipeline/selector_001/pcap_files/out_62.txt' + out_pcap_3 = 'pipeline/selector_001/pcap_files/out_63.txt' + out_pcap_4 = 'pipeline/selector_001/pcap_files/out_64.txt' + out_pcap = [out_pcap_1, out_pcap_2, out_pcap_3, out_pcap_4] + filters = ["tcp"] * 4 + tx_port = [0] + rx_port = [0, 1, 2, 3] + self.send_and_sniff_multiple(tx_port, rx_port, in_pcap, out_pcap, filters) + + # [7]: Delete group with ID: 0 + # All packets of this group should use member with ID 0. + CLI_CMD = 'pipeline PIPELINE0 selector selector_001 group delete 0\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = 'pipeline/selector_001/pcap_files/in_7.txt' + out_pcap = 'pipeline/selector_001/pcap_files/out_7.txt' + self.send_and_sniff_pkts(1, 0, in_pcap, out_pcap, "tcp") + + # [8]: Delete member with member ID 3 of Group ID 1 + # Group ID 1: [Member IDs: 0, 1, 2; Weights: 1, 1, 2] [25% : 25% : 50%] + CMD_FILE = '/tmp/pipeline/selector_001/cmd_files/cmd_8.txt' + CLI_CMD = 'pipeline PIPELINE0 selector selector_001 group member delete {}\n'.format(CMD_FILE) + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + CLI_CMD = 'pipeline PIPELINE0 commit\n' + self.socket_send_cmd(s, CLI_CMD, "pipeline> ") + in_pcap = ['pipeline/selector_001/pcap_files/in_8.txt'] + out_pcap_1 = 'pipeline/selector_001/pcap_files/out_81.txt' + out_pcap_2 = 'pipeline/selector_001/pcap_files/out_82.txt' + out_pcap_3 = 'pipeline/selector_001/pcap_files/out_83.txt' + out_pcap = [out_pcap_1, out_pcap_2, out_pcap_3] + filters = ["tcp"] * 3 + tx_port = [0] + rx_port = [0, 1, 2] + self.send_and_sniff_multiple(tx_port, rx_port, in_pcap, out_pcap, filters) + + s.close() + self.dut.send_expect("^C", "# ", 20) + + def test_selector_002(self): + + cli_file = '/tmp/pipeline/selector_002/selector_002.cli' + self.run_dpdk_app(cli_file) + + in_pcap = ['pipeline/selector_002/pcap_files/in_1.txt'] + out_pcap_1 = 'pipeline/selector_002/pcap_files/out_1.txt' + out_pcap_2 = 'pipeline/selector_002/pcap_files/out_2.txt' + out_pcap_3 = 'pipeline/selector_002/pcap_files/out_3.txt' + out_pcap_4 = 'pipeline/selector_002/pcap_files/out_4.txt' + out_pcap = [out_pcap_1, out_pcap_2, out_pcap_3, out_pcap_4] + filters = ["tcp"] * 4 + tx_port = [0] + rx_port = [0, 1, 2, 3] + self.send_and_sniff_multiple(tx_port, rx_port, in_pcap, out_pcap, filters) + self.dut.send_expect("^C", "# ", 20) + + def test_scapy_pkt_gen(self): + + # self.send_scapy_pkts(0) + pass + def tear_down(self): """ Run after each test case. -- 1.8.3.1