From: Churchill Khangar <churchill.khangar@intel.com>
To: dts@dpdk.org
Cc: cristian.dumitrescu@intel.com, venkata.suresh.kumar.p@intel.com,
churchill.khangar@intel.com, yogesh.jangra@intel.com
Subject: [dts] [PATCH v2 1/2] tests/pipeline: add table default and normal rule tests
Date: Thu, 26 Nov 2020 02:50:50 -0500 [thread overview]
Message-ID: <1606377051-47458-2-git-send-email-churchill.khangar@intel.com> (raw)
In-Reply-To: <1606377051-47458-1-git-send-email-churchill.khangar@intel.com>
Add additional pipeline table test scenarios to verify
the behavior of pipeline library when table is populated
with normal rules, default rule and action.
Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
Tested-by: Venkata Suresh Kumar P <venkata.suresh.kumar.p@intel.com>
---
tests/TestSuite_pipeline.py | 215 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 215 insertions(+)
diff --git a/tests/TestSuite_pipeline.py b/tests/TestSuite_pipeline.py
index 9b13575..9933fd7 100644
--- a/tests/TestSuite_pipeline.py
+++ b/tests/TestSuite_pipeline.py
@@ -32,6 +32,7 @@
import utils
import re
import time
+import socket
from settings import HEADER_SIZE
from test_case import TestCase
@@ -5818,6 +5819,220 @@ class TestPipeline(TestCase):
cmd = "^C"
self.dut.send_expect(cmd, "# ", 20)
+ def test_table_002(self):
+
+ cli_file = '/tmp/pipeline/table_002/table_002.cli'
+
+ cmd = "sed -i -e 's/0000:00:04.0/%s/' {}".format(cli_file) % self.dut_p0_pci
+ self.dut.send_expect(cmd, "# ", 20)
+ cmd = "sed -i -e 's/0000:00:05.0/%s/' {}".format(cli_file) % self.dut_p1_pci
+ self.dut.send_expect(cmd, "# ", 20)
+ cmd = "sed -i -e 's/0000:00:06.0/%s/' {}".format(cli_file) % self.dut_p2_pci
+ self.dut.send_expect(cmd, "# ", 20)
+ cmd = "sed -i -e 's/0000:00:07.0/%s/' {}".format(cli_file) % self.dut_p3_pci
+ self.dut.send_expect(cmd, "# ", 20)
+
+ DUT_PORTS = " -w {0} -w {1} -w {2} -w {3} "\
+ .format(self.dut_p0_pci, self.dut_p1_pci, self.dut_p2_pci, self.dut_p3_pci)
+
+ cmd = "{0} -c 0x3 -n 4 {1} -- -s {2}".format(self.app_pipeline_path, DUT_PORTS, cli_file)
+ self.dut.send_expect(cmd, "PIPELINE0 enable", 60)
+
+ sleep(2)
+
+ # create TCP connection to the server
+ SERVER_IP = '192.168.122.216'
+ SERVER_PORT = 8086
+ BUFFER_SIZE = 1024
+
+ try:
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ except socket.error as err:
+ print("socket creation failed with error %s" % (err))
+
+ try:
+ s.connect((SERVER_IP, SERVER_PORT))
+ except socket.error as err:
+ print("socket connection failed with error %s" % (err))
+
+ sleep(0.1)
+ msg = s.recv(BUFFER_SIZE)
+ response = msg.decode()
+ # print('Rxd: ' + response)
+ if "pipeline>" not in response:
+ s.close()
+ self.verify(0, "CLI response error")
+
+ # test empty table scenario
+ in_pcap_file = 'pipeline/table_002/pcap_files/in_1.txt'
+ out_pcap_file = 'pipeline/table_002/pcap_files/out_1.txt'
+ filters = "tcp"
+ sniff_pkts = self.send_and_sniff_pkts(0, 0, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(1, 1, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(2, 2, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(3, 3, in_pcap_file, out_pcap_file, filters)
+
+ # test single rule scenario
+ CMD_FILE = '/tmp/pipeline/table_002/cmd_files/cmd_2.txt'
+ CLI_CMD = 'pipeline PIPELINE0 table table_002_table update {} none none\n'.format(CMD_FILE)
+ s.send(CLI_CMD.encode('utf-8'))
+ sleep(0.1)
+ msg = s.recv(BUFFER_SIZE)
+ response = msg.decode()
+ # print('Rxd: ' + response)
+ if "pipeline>" not in response:
+ s.close()
+ self.verify(0, "CLI response error")
+ filters = "tcp"
+ in_pcap_file = 'pipeline/table_002/pcap_files/in_2.txt'
+ out_pcap_file = 'pipeline/table_002/pcap_files/out_2.txt'
+ sniff_pkts = self.send_and_sniff_pkts(0, 0, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(1, 1, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(2, 2, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(3, 3, in_pcap_file, out_pcap_file, filters)
+
+ # test two rules scenario
+ CMD_FILE = '/tmp/pipeline/table_002/cmd_files/cmd_3.txt'
+ CLI_CMD = 'pipeline PIPELINE0 table table_002_table update {} none none\n'.format(CMD_FILE)
+ s.send(CLI_CMD.encode('utf-8'))
+ sleep(0.1)
+ msg = s.recv(BUFFER_SIZE)
+ response = msg.decode()
+ # print('Rxd: ' + response)
+ if "pipeline>" not in response:
+ s.close()
+ self.verify(0, "CLI response error")
+ filters = "tcp"
+ in_pcap_file = 'pipeline/table_002/pcap_files/in_3.txt'
+ out_pcap_file = 'pipeline/table_002/pcap_files/out_3.txt'
+ sniff_pkts = self.send_and_sniff_pkts(0, 0, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(1, 1, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(2, 2, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(3, 3, in_pcap_file, out_pcap_file, filters)
+
+ # delete one rule scenario
+ CMD_FILE = '/tmp/pipeline/table_002/cmd_files/cmd_4_1.txt'
+ CLI_CMD = 'pipeline PIPELINE0 table table_002_table update none {} none\n'.format(CMD_FILE)
+ s.send(CLI_CMD.encode('utf-8'))
+ sleep(0.1)
+ msg = s.recv(BUFFER_SIZE)
+ response = msg.decode()
+ # print('Rxd: ' + response)
+ if "pipeline>" not in response:
+ s.close()
+ self.verify(0, "CLI response error")
+ filters = "tcp"
+ in_pcap_file = 'pipeline/table_002/pcap_files/in_4_1.txt'
+ out_pcap_file = 'pipeline/table_002/pcap_files/out_4_1.txt'
+ sniff_pkts = self.send_and_sniff_pkts(0, 0, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(1, 1, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(2, 2, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(3, 3, in_pcap_file, out_pcap_file, filters)
+
+ # delete all rules scenario
+ CMD_FILE = '/tmp/pipeline/table_002/cmd_files/cmd_4_2.txt'
+ CLI_CMD = 'pipeline PIPELINE0 table table_002_table update none {} none\n'.format(CMD_FILE)
+ s.send(CLI_CMD.encode('utf-8'))
+ sleep(0.1)
+ msg = s.recv(BUFFER_SIZE)
+ response = msg.decode()
+ # print('Rxd: ' + response)
+ if "pipeline>" not in response:
+ s.close()
+ self.verify(0, "CLI response error")
+ filters = "tcp"
+ in_pcap_file = 'pipeline/table_002/pcap_files/in_4_2.txt'
+ out_pcap_file = 'pipeline/table_002/pcap_files/out_4_2.txt'
+ sniff_pkts = self.send_and_sniff_pkts(0, 0, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(1, 1, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(2, 2, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(3, 3, in_pcap_file, out_pcap_file, filters)
+
+ # action update scenario (restore one of the previously deleted rules and check the update)
+ CMD_FILE = '/tmp/pipeline/table_002/cmd_files/cmd_5_1.txt'
+ CLI_CMD = 'pipeline PIPELINE0 table table_002_table update {} none none\n'.format(CMD_FILE)
+ s.send(CLI_CMD.encode('utf-8'))
+ sleep(0.1)
+ msg = s.recv(BUFFER_SIZE)
+ response = msg.decode()
+ print('Rxd: ' + response)
+ if "pipeline>" not in response:
+ s.close()
+ self.verify(0, "CLI response error")
+ filters = "tcp"
+ in_pcap_file = 'pipeline/table_002/pcap_files/in_5_1.txt'
+ out_pcap_file = 'pipeline/table_002/pcap_files/out_5_1.txt'
+ sniff_pkts = self.send_and_sniff_pkts(0, 0, in_pcap_file, out_pcap_file, filters)
+
+ # action update scenario (change the action of restored rule and check the update)
+ CMD_FILE = '/tmp/pipeline/table_002/cmd_files/cmd_5_2.txt'
+ CLI_CMD = 'pipeline PIPELINE0 table table_002_table update {} none none\n'.format(CMD_FILE)
+ s.send(CLI_CMD.encode('utf-8'))
+ sleep(0.1)
+ msg = s.recv(BUFFER_SIZE)
+ response = msg.decode()
+ print('Rxd: ' + response)
+ if "pipeline>" not in response:
+ s.close()
+ self.verify(0, "CLI response error")
+ filters = "tcp"
+ in_pcap_file = 'pipeline/table_002/pcap_files/in_5_1.txt'
+ out_pcap_file = 'pipeline/table_002/pcap_files/out_5_1.txt'
+ sniff_pkts = self.send_and_sniff_pkts(0, 1, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(1, 0, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(2, 3, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(3, 2, in_pcap_file, out_pcap_file, filters)
+
+ # deafult action scenario [empty table]
+ '''
+ Empty table => Lookup MISS with default action executed
+ '''
+ CMD_FILE = '/tmp/pipeline/table_002/cmd_files/cmd_6_1.txt' # delete the previously added rule
+ CLI_CMD = 'pipeline PIPELINE0 table table_002_table update none {} none\n'.format(CMD_FILE)
+ s.send(CLI_CMD.encode('utf-8'))
+ sleep(0.1)
+ msg = s.recv(BUFFER_SIZE)
+ response = msg.decode()
+ print('Rxd: ' + response)
+ if "pipeline>" not in response:
+ s.close()
+ self.verify(0, "CLI response error")
+ filters = "tcp"
+ in_pcap_file = 'pipeline/table_002/pcap_files/in_6_1.txt'
+ out_pcap_file = 'pipeline/table_002/pcap_files/out_6_1.txt'
+ sniff_pkts = self.send_and_sniff_pkts(0, 0, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(1, 1, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(2, 2, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(3, 3, in_pcap_file, out_pcap_file, filters)
+
+ # deafult action scenario [table with one rule]
+ '''
+ Add key A => Lookup HIT for the right packet with the specific key associated action executed
+ Lookup MISS for any other packets with default action executed
+ '''
+ CMD_FILE = '/tmp/pipeline/table_002/cmd_files/cmd_6_2.txt' # add a new rule
+ CLI_CMD = 'pipeline PIPELINE0 table table_002_table update {} none none\n'.format(CMD_FILE)
+ s.send(CLI_CMD.encode('utf-8'))
+ sleep(0.1)
+ msg = s.recv(BUFFER_SIZE)
+ response = msg.decode()
+ print('Rxd: ' + response)
+ if "pipeline>" not in response:
+ s.close()
+ self.verify(0, "CLI response error")
+ filters = "tcp"
+ in_pcap_file = 'pipeline/table_002/pcap_files/in_6_2.txt'
+ out_pcap_file = 'pipeline/table_002/pcap_files/out_6_2.txt'
+ sniff_pkts = self.send_and_sniff_pkts(0, 0, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(1, 1, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(2, 2, in_pcap_file, out_pcap_file, filters)
+ sniff_pkts = self.send_and_sniff_pkts(3, 3, in_pcap_file, out_pcap_file, filters)
+
+ s.close()
+ sleep(1)
+ cmd = "^C"
+ self.dut.send_expect(cmd, "# ", 20)
+
def tear_down(self):
"""
Run after each test case.
--
1.8.3.1
next prev parent reply other threads:[~2020-11-26 7:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 7:50 [dts] [PATCH v2 0/2] Add pipeline additional table tests Churchill Khangar
2020-11-26 7:50 ` Churchill Khangar [this message]
2020-11-26 7:50 ` [dts] [PATCH v2 2/2] dep: add pipeline additional table tests dependencies Churchill Khangar
2020-11-26 8:03 ` [dts] [PATCH v2 0/2] Add pipeline additional table tests Tu, Lijuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1606377051-47458-2-git-send-email-churchill.khangar@intel.com \
--to=churchill.khangar@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dts@dpdk.org \
--cc=venkata.suresh.kumar.p@intel.com \
--cc=yogesh.jangra@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).