diff options
Diffstat (limited to 'scripts/automation/trex_control_plane')
7 files changed, 70 insertions, 50 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 08720e8d..953c5c84 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 @@ -69,7 +69,8 @@ STLClient snippet .. code-block:: python - :caption: Example 1: Minimal example of client interacting with the TRex server + + # Example 1: Minimal example of client interacting with the TRex server c = STLClient() @@ -102,7 +103,8 @@ STLClient snippet .. code-block:: python - :caption: Example 2: Client can execute other functions while the TRex server is generating traffic + + # Example 2: Client can execute other functions while the TRex server is generating traffic c = STLClient() @@ -128,7 +130,8 @@ STLClient snippet .. code-block:: python - :caption: Example 3: Console-like API interface + + # Example 3: Console-like API interface def simple (): @@ -224,7 +227,8 @@ Example 4: Load profile from a file:: .. code-block:: python - :caption: Example 5: pin cores to ports + + # Example 5: pin cores to ports c = STLClient() 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 index d4f95170..39afa38b 100755 --- a/scripts/automation/trex_control_plane/doc_stl/api/field_engine.rst +++ b/scripts/automation/trex_control_plane/doc_stl/api/field_engine.rst @@ -153,7 +153,8 @@ Field Engine snippet -------------------- .. code-block:: python - :caption: FE Example1 + + # FE Example1 base_pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025) @@ -177,7 +178,8 @@ Field Engine snippet .. code-block:: python - :caption: FE Example2 + + # FE Example2 #range of source mac-addr 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 index 335105f1..8a0d7a2a 100755 --- a/scripts/automation/trex_control_plane/doc_stl/api/profile_code.rst +++ b/scripts/automation/trex_control_plane/doc_stl/api/profile_code.rst @@ -88,7 +88,8 @@ STLProfile snippet .. code-block:: python - :caption: STLProfile Example1 + + # STLProfile Example1 size = self.fsize - 4; # no FCS @@ -119,7 +120,8 @@ STLProfile snippet .. code-block:: python - :caption: STLProfile Example2 + + # STLProfile Example2 class STLS1(object): diff --git a/scripts/automation/trex_control_plane/server/CCustomLogger.py b/scripts/automation/trex_control_plane/server/CCustomLogger.py index 6d3974a6..fd9a32ad 100755 --- a/scripts/automation/trex_control_plane/server/CCustomLogger.py +++ b/scripts/automation/trex_control_plane/server/CCustomLogger.py @@ -10,6 +10,7 @@ def prepare_dir(log_path): def setup_custom_logger(name, log_path = None):
# first make sure path availabe
+ prepare_dir(log_path)
logging.basicConfig(level = logging.INFO,
format = '%(asctime)s %(name)-10s %(module)-20s %(levelname)-8s %(message)s',
datefmt = '%m-%d %H:%M')
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py index fc49bf77..3fe31d4d 100755 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py @@ -482,8 +482,8 @@ class STLClient(object): the ASYNC port .. code-block:: python - :caption: Example + # Example # connect to local TRex server c = STLClient() diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py index e12efaf9..b97cc5f8 100755 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py @@ -202,8 +202,8 @@ class STLScVmRaw(CTRexScriptsBase): The following example splits the generated traffic by "ip_src" variable. .. code-block:: python - :caption: Split by + # Split by # TCP SYN base_pkt = Ether()/IP(dst="48.0.0.1")/TCP(dport=80,flags="S") @@ -612,8 +612,8 @@ class STLVmFlowVar(CTRexVmDescBase): Possible values: "inc", "dec", "random" .. code-block:: python - :caption: Example1 + # Example1 # input STLVmFlowVar(min_value=0, max_value=3, size=1,op="inc") @@ -676,7 +676,8 @@ class STLVmFixIpv4(CTRexVmDescBase): in could be string in case of scapy packet. format IP[:[id]] .. code-block:: python - :caption: Example2 + + # Example2 pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025) @@ -729,7 +730,8 @@ class STLVmWrFlowVar(CTRexVmDescBase): How to write the variable to the the packet. True=big-endian, False=little-endian .. code-block:: python - :caption: Example3 + + # Example3 pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025) @@ -1036,7 +1038,8 @@ class STLVmTupleGen(CTRexVmDescBase): ="0.0.0.10", port_min=1025, port_max=65535, limit_flows=100000, flags=0 .. code-block:: python - :caption: Example5 + + # Example5 def create_stream (self): # pkt @@ -1113,35 +1116,35 @@ class STLPktBuilder(CTrexPktBuilderInterface): .. code-block:: python - :caption: Example6 - - # packet is scapy - STLPktBuilder( pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/(10*'x') ) + # Example6 + + # packet is scapy + STLPktBuilder( pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/(10*'x') ) - # packet is taken from pcap file relative to python - STLPktBuilder( pkt ="stl/yaml/udp_64B_no_crc.pcap") + # packet is taken from pcap file relative to python + STLPktBuilder( pkt ="stl/yaml/udp_64B_no_crc.pcap") - # packet is taken from pcap file relative to profile file - STLPktBuilder( pkt ="stl/yaml/udp_64B_no_crc.pcap", - path_relative_to_profile = True ) + # packet is taken from pcap file relative to profile file + STLPktBuilder( pkt ="stl/yaml/udp_64B_no_crc.pcap", + path_relative_to_profile = True ) - vm = STLScVmRaw( [ STLVmTupleGen ( ip_min="16.0.0.1", ip_max="16.0.0.2", - port_min=1025, port_max=65535, - name="tuple"), # define tuple gen + vm = STLScVmRaw( [ STLVmTupleGen ( ip_min="16.0.0.1", ip_max="16.0.0.2", + port_min=1025, port_max=65535, + name="tuple"), # define tuple gen - STLVmWrFlowVar (fv_name="tuple.ip", pkt_offset= "IP.src" ), # write ip to packet IP.src - STLVmFixIpv4(offset = "IP"), # fix checksum - STLVmWrFlowVar (fv_name="tuple.port", pkt_offset= "UDP.sport" ) #write udp.port - ] - ) + STLVmWrFlowVar (fv_name="tuple.ip", pkt_offset= "IP.src" ), # write ip to packet IP.src + STLVmFixIpv4(offset = "IP"), # fix checksum + STLVmWrFlowVar (fv_name="tuple.port", pkt_offset= "UDP.sport" ) #write udp.port + ] + ) - base_pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025) - pad = max(0, size - len(base_pkt)) * 'x' + base_pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025) + pad = max(0, size - len(base_pkt)) * 'x' - STLPktBuilder(pkt = base_pkt/pad, vm= vm) + STLPktBuilder(pkt = base_pkt/pad, vm= vm) :parameters: diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py index 50751111..bfcf063a 100755 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py @@ -41,15 +41,16 @@ class STLTXMode(object): Link interface percent (0-100). Example: 10 is 10% of the port link setup .. code-block:: python - :caption: STLTXMode Example - mode = STLTXCont(pps = 10) + # STLTXMode Example - mode = STLTXCont(bps_L1 = 10000000) #10mbps L1 + mode = STLTXCont(pps = 10) - mode = STLTXCont(bps_L2 = 10000000) #10mbps L2 + mode = STLTXCont(bps_L1 = 10000000) #10mbps L1 - mode = STLTXCont(percentage = 10) #10% + mode = STLTXCont(bps_L2 = 10000000) #10mbps L2 + + mode = STLTXCont(percentage = 10) #10% """ @@ -106,9 +107,10 @@ class STLTXCont(STLTXMode): see :class:`trex_stl_lib.trex_stl_streams.STLTXMode` for rate .. code-block:: python - :caption: STLTXCont Example - mode = STLTXCont(pps = 10) + # STLTXCont Example + + mode = STLTXCont(pps = 10) """ super(STLTXCont, self).__init__(**kwargs) @@ -135,9 +137,10 @@ class STLTXSingleBurst(STLTXMode): see :class:`trex_stl_lib.trex_stl_streams.STLTXMode` for rate .. code-block:: python - :caption: STLTXSingleBurst Example - mode = STLTXSingleBurst( pps = 10, total_pkts = 1) + # STLTXSingleBurst Example + + mode = STLTXSingleBurst( pps = 10, total_pkts = 1) """ @@ -180,9 +183,10 @@ class STLTXMultiBurst(STLTXMode): see :class:`trex_stl_lib.trex_stl_streams.STLTXMode` for rate .. code-block:: python - :caption: STLTXMultiBurst Example - mode = STLTXMultiBurst(pps = 10, pkts_per_burst = 1,count 10, ibg=10.0) + # STLTXMultiBurst Example + + mode = STLTXMultiBurst(pps = 10, pkts_per_burst = 1,count 10, ibg=10.0) """ @@ -230,7 +234,8 @@ class STLFlowStats(STLFlowStatsInterface): """ Define per stream basic stats .. code-block:: python - :caption: STLFlowStats Example + + # STLFlowStats Example flow_stats = STLFlowStats(pg_id = 7) @@ -245,7 +250,8 @@ class STLFlowLatencyStats(STLFlowStatsInterface): """ Define per stream basic stats + latency, jitter, packet reorder/loss .. code-block:: python - :caption: STLFlowLatencyStats Example + + # STLFlowLatencyStats Example flow_stats = STLFlowLatencyStats(pg_id = 7) @@ -260,7 +266,8 @@ class STLStream(object): """ One stream object. Includes mode, Field Engine mode packet template and Rx stats .. code-block:: python - :caption: STLStream Example + + # STLStream Example base_pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025) @@ -825,9 +832,10 @@ class STLProfile(object): """ Describe a list of streams .. code-block:: python - :caption: STLProfile Example - profile = STLProfile( [ STLStream( isg = 10.0, # star in delay + # STLProfile Example + + profile = STLProfile( [ STLStream( isg = 10.0, # star in delay name ='S0', packet = STLPktBuilder(pkt = base_pkt/pad), mode = STLTXSingleBurst( pps = 10, total_pkts = self.burst_size), |