From: wang fei <feix.y.wang@intel.com>
To: dts@dpdk.org
Cc: wang fei <feix.y.wang@intel.com>
Subject: [dts] [PATCH V1] framework/tester.py: add TREX support in DTS framework
Date: Wed, 20 Dec 2017 18:54:37 +0800 [thread overview]
Message-ID: <1513767277-30987-1-git-send-email-feix.y.wang@intel.com> (raw)
Signed-off-by: wang fei <feix.y.wang@intel.com>
---
framework/tester.py | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/framework/tester.py b/framework/tester.py
index 1c854d7..d09305c 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -45,8 +45,9 @@ import random
from utils import GREEN, convert_int2ip, convert_ip2int
from exception import ParameterInvalidException
from multiprocessing import Process
+from uuid import uuid4
-
+from pktgen import getPacketGenerator
class Tester(Crb):
"""
@@ -79,6 +80,21 @@ class Tester(Crb):
self.ixia_packet_gen = IxiaPacketGenerator(self)
self.packet_gen = SoftwarePacketGenerator(self)
+ def new_session(self):
+ """
+ Create new session for dut instance. Session name will be unique.
+ """
+ session_name = self.NAME + '_' + str(uuid4())
+ session = self.create_session(name=session_name)
+ session.logger.config_execution(self.NAME)
+ return session
+
+ def close_session(self, session):
+ """
+ close new session in dut instance
+ """
+ self.destroy_session(session)
+
def set_re_run(self, re_run_time):
"""
set failed case re-run time
@@ -139,6 +155,7 @@ class Tester(Crb):
self.pci_devices_information()
self.restore_interfaces()
self.scan_ports()
+ self.pktgen_init()
def get_local_port(self, remotePort):
"""
@@ -379,6 +396,14 @@ class Tester(Crb):
'mac': macaddr,
'ipv6': ipv6})
+ def pktgen_init(self):
+ # should load pktgen type from configuration, now just try
+ pktgen_type = "TREX"
+ # init packet generator instance
+ self.pktgen = getPacketGenerator(self, pktgen_type)
+ # prepare running environment
+ self.pktgen.prepare_generator()
+
def send_ping(self, localPort, ipv4, mac):
"""
Send ping6 packet from local port with destination ipv4 address.
--
2.7.4
reply other threads:[~2017-12-20 8:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1513767277-30987-1-git-send-email-feix.y.wang@intel.com \
--to=feix.y.wang@intel.com \
--cc=dts@dpdk.org \
/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).