summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/doc_stl
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-08-24 16:30:03 +0300
committerHanoh Haim <hhaim@cisco.com>2016-08-24 16:30:03 +0300
commitba0f070420f9d1f56731415ca247f35926137ff3 (patch)
tree2b15bc1240c2b5ee8d50822573a2bc2f12593196 /scripts/automation/trex_control_plane/doc_stl
parenta70d3f379e7551851cffffcdd77410210235c47c (diff)
v2.08
Diffstat (limited to 'scripts/automation/trex_control_plane/doc_stl')
-rwxr-xr-xscripts/automation/trex_control_plane/doc_stl/api/client_code.rst36
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/automation/trex_control_plane/doc_stl/api/client_code.rst b/scripts/automation/trex_control_plane/doc_stl/api/client_code.rst
index 165a9a0d..08720e8d 100755
--- a/scripts/automation/trex_control_plane/doc_stl/api/client_code.rst
+++ b/scripts/automation/trex_control_plane/doc_stl/api/client_code.rst
@@ -14,6 +14,10 @@ In addition to the Python API, a console-based API interface is also available.
Python-like example::
c.start(ports = [0, 1], mult = "5mpps", duration = 10)
+
+ c.start(ports = [0, 1], mult = "5mpps", duration = 10, core_mask = [0x1,0xe] )
+
+ c.start(ports = [0, 1], mult = "5mpps", duration = 10, core_mask = core_mask=STLClient.CORE_MASK_PIN )
Console-like example::
@@ -96,6 +100,7 @@ STLClient snippet
c.disconnect()
+
.. code-block:: python
:caption: Example 2: Client can execute other functions while the TRex server is generating traffic
@@ -218,3 +223,34 @@ Example 4: Load profile from a file::
c.disconnect()
+.. code-block:: python
+ :caption: Example 5: pin cores to ports
+
+ c = STLClient()
+
+ try:
+ # connect to server
+ c.connect()
+
+ # prepare our ports (my machine has 0 <--> 1 with static route)
+ c.reset(ports = [0, 1])
+
+ # add both streams to ports
+ c.add_streams(s1, ports = [0])
+
+ # clear the stats before injecting
+ c.clear_stats()
+
+ c.start(ports = [0, 1], mult = "5mpps", duration = 10, core_mask = [0x1,0x2]) # pin core to ports for better performance
+
+ # block until done
+ c.wait_on_traffic(ports = [0, 1])
+
+ # check for any warnings
+ if c.get_warnings():
+ # handle warnings here
+ pass
+
+ finally:
+ c.disconnect()
+