From ba0f070420f9d1f56731415ca247f35926137ff3 Mon Sep 17 00:00:00 2001 From: Hanoh Haim Date: Wed, 24 Aug 2016 16:30:03 +0300 Subject: v2.08 --- .../trex_control_plane/doc_stl/api/client_code.rst | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'scripts/automation') 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() + -- cgit 1.2.3-korg