From a627a1d4a35f27e0da4599fbeddae97bc5470010 Mon Sep 17 00:00:00 2001 From: DavidBlock Date: Thu, 31 Mar 2016 16:09:06 +0300 Subject: David edits of trex-core api material --- .../trex_control_plane/doc_stl/api/client_code.rst | 27 ++++++++++++++-------- .../doc_stl/api/field_engine.rst | 14 +++++------ .../trex_control_plane/doc_stl/api/index.rst | 0 .../doc_stl/api/profile_code.rst | 8 +++---- .../doc_stl/api/scapy_builder.rst | 10 ++++---- 5 files changed, 33 insertions(+), 26 deletions(-) mode change 100644 => 100755 scripts/automation/trex_control_plane/doc_stl/api/client_code.rst mode change 100644 => 100755 scripts/automation/trex_control_plane/doc_stl/api/field_engine.rst mode change 100644 => 100755 scripts/automation/trex_control_plane/doc_stl/api/index.rst mode change 100644 => 100755 scripts/automation/trex_control_plane/doc_stl/api/profile_code.rst mode change 100644 => 100755 scripts/automation/trex_control_plane/doc_stl/api/scapy_builder.rst (limited to 'scripts/automation/trex_control_plane/doc_stl') 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 old mode 100644 new mode 100755 index 8736e98d..fff3052e --- a/scripts/automation/trex_control_plane/doc_stl/api/client_code.rst +++ b/scripts/automation/trex_control_plane/doc_stl/api/client_code.rst @@ -2,16 +2,23 @@ Client Module ================== -TRex Client is an object to access TRex server. It is per user. Each user can own number of interfaces. -Multi user can interact with one TRex server each user should own a different set of interfaces. +The TRex Client provides access to the TRex server. + +**Client and interfaces** + +Multiple users can interact with one TRex server. Each user "owns" a different set of interfaces. The protocol is JSON-RPC2 over ZMQ transport. -The API has two type of API +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) + +Console-like example:: +.. c.start_line (" -f ../../../../stl/udp_1pkt_simple.py -m 10mpps --port 0 1 ") -1. Normal API -2. xx_line: this api get a line like the Console and parse it and call the low level api -Example1:: +Example 1 - Typical Python API:: c = STLClient(username = "itay",server = "10.0.0.10", verbose_level = LoggerApi.VERBOSE_HIGH) @@ -49,7 +56,7 @@ STLClient snippet ----------------- -Example1:: +Example 1: Minimal example of client interacting with the TRex server:: c = STLClient() @@ -76,7 +83,7 @@ Example1:: -Example2: wait while doing somthing:: +Example 2: Client can execute other functions while the TRex server is generating traffic:: c = STLClient() try: @@ -99,7 +106,7 @@ Example2: wait while doing somthing:: c.disconnect() -Example3: Console like:: +Example 3: Console-like API interface:: def simple (): @@ -148,7 +155,7 @@ Example3: Console like:: finally: c.disconnect() -Example4: Load profile from a file:: +Example 4: Load profile from a file:: def simple (): diff --git a/scripts/automation/trex_control_plane/doc_stl/api/field_engine.rst b/scripts/automation/trex_control_plane/doc_stl/api/field_engine.rst old mode 100644 new mode 100755 index d134b0b9..541e195f --- a/scripts/automation/trex_control_plane/doc_stl/api/field_engine.rst +++ b/scripts/automation/trex_control_plane/doc_stl/api/field_engine.rst @@ -2,19 +2,19 @@ Field Engine modules ======================= -The Field Engine (FE) has limited number of instructions/operation for supporting most use cases. +The Field Engine (FE) has limited number of instructions/operations to support most use cases. There is a plan to add LuaJIT to be more flexible at the cost of performance. -The FE can allocate stream variables in a Stream context, write a stream variable to a packet offset, change packet size, etc. +The FE can allocate stream variables in a stream context, write a stream variable to a packet offset, change packet size, and so on. -*Some examples for what can be done:* +*Examples of Field Engine uses:* * Change ipv4.tos 1-10 -* Change packet size to be random in the range 64-9K -* Create range of flows (change src_ip, dest_ip, src_port, dest_port) +* Change packet size to a random value in the range 64 to 9K +* Create a range of flows (change src_ip, dest_ip, src_port, dest_port) * Update IPv4 checksum -Snippet will create SYN Attack:: +The following snippet creates a SYN attack:: # create attack from random src_ip from 16.0.0.0-18.0.0.254 and random src_port 1025-65000 # attack 48.0.0.1 server @@ -60,7 +60,7 @@ Snippet will create SYN Attack:: STLScVmRaw class ---------------- -Aggregate a raw instructions objects +Aggregate raw instructions objects .. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.STLScVmRaw :members: diff --git a/scripts/automation/trex_control_plane/doc_stl/api/index.rst b/scripts/automation/trex_control_plane/doc_stl/api/index.rst old mode 100644 new mode 100755 diff --git a/scripts/automation/trex_control_plane/doc_stl/api/profile_code.rst b/scripts/automation/trex_control_plane/doc_stl/api/profile_code.rst old mode 100644 new mode 100755 index b61f05e4..9afa9df2 --- a/scripts/automation/trex_control_plane/doc_stl/api/profile_code.rst +++ b/scripts/automation/trex_control_plane/doc_stl/api/profile_code.rst @@ -2,13 +2,13 @@ Traffic profile modules ======================= -TRex STLProfile profile include a list of STLStream. The profile is a ``program`` of streams with a relation betwean the streams. -Each stream can trigger another stream. Stream can be given a name for a full examples see here Manual_. +The TRex STLProfile traffic profile includes a number of streams. The profile is a ``program`` of related streams. +Each stream can trigger another stream. Each stream can be named. For a full set of examples, see Manual_. -.. _Manual: ../draft_trex_stateless1.html +.. _Manual: ../trex_stateless.html -for example:: +Example:: def create_stream (self): diff --git a/scripts/automation/trex_control_plane/doc_stl/api/scapy_builder.rst b/scripts/automation/trex_control_plane/doc_stl/api/scapy_builder.rst old mode 100644 new mode 100755 index 5544df63..2c5790bf --- a/scripts/automation/trex_control_plane/doc_stl/api/scapy_builder.rst +++ b/scripts/automation/trex_control_plane/doc_stl/api/scapy_builder.rst @@ -2,15 +2,15 @@ Packet builder modules ======================= -The packet builder module objective is to build a template packet for a stream and to create a Field engine program to change fields in the packet. +The packet builder module is used for building a template packet for a stream, and creating a Field Engine program to change fields in the packet. -**Some examples for what can be done:** +**Examples:** -* Build a IP/UDP/DNS packet and create a range of src_ip = 10.0.0.1-10.0.0.255 -* Build a IP/UDP packets in IMIX sizes +* Build a IP/UDP/DNS packet with a src_ip range of 10.0.0.1 to 10.0.0.255 +* Build IP/UDP packets in IMIX sizes -for example this snippet will create SYN Attack:: +For example, this snippet creates a SYN attack:: # create attack from random src_ip from 16.0.0.0-18.0.0.254 and random src_port 1025-65000 # attack 48.0.0.1 server -- cgit 1.2.3-korg