diff options
-rwxr-xr-x | scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py | 31 | ||||
-rwxr-xr-x | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py | 28 | ||||
-rwxr-xr-x | scripts/automation/trex_perf.py | 5 | ||||
-rw-r--r-- | src/main_dpdk.cpp | 16 |
4 files changed, 69 insertions, 11 deletions
diff --git a/scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py b/scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py index 065f4284..d2fcdff3 100755 --- a/scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py +++ b/scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py @@ -4,6 +4,7 @@ import argparse import sys import os from time import sleep +from pprint import pprint # ext libs ext_libs = os.path.join(os.pardir, os.pardir, os.pardir, os.pardir, 'external_libs') @@ -74,14 +75,40 @@ if __name__ == '__main__': print('Sending pcap to ports %s' % ports) verify(server.push_remote(pcap_filename = 'stl/sample.pcap')) + sleep(3) print('Getting stats') res = verify(server.get_stats()) - print('Stats: %s' % res[1]) + pprint(res[1]) print('Resetting all ports') verify(server.reset()) + imix_path_1 = '../../../../stl/imix.py' + imix_path_2 = '../../stl/imix.py' + if os.path.exists(imix_path_1): + imix_path = imix_path_1 + elif os.path.exists(imix_path_2): + imix_path = imix_path_2 + else: + print('Could not find path of imix profile, skipping') + imix_path = None + + if imix_path: + print('Adding profile %s' % imix_path) + verify(server.native_method(func_name = 'add_profile', filename = imix_path)) + + print('Start traffic for 5 sec') + verify(server.native_method('start')) + sleep(5) + + print('Getting stats') + res = verify(server.get_stats()) + pprint(res[1]) + + print('Resetting all ports') + verify(server.reset()) + print('Deleting Native Client instance') verify(server.native_proxy_del()) @@ -116,7 +143,7 @@ if __name__ == '__main__': print('Getting stats') res = verify_hlt(server.traffic_stats(mode = 'aggregate', port_handle = ports[:2])) - print(res) + pprint(res) print('Deleting HLTAPI Client instance') verify_hlt(server.hltapi_proxy_del()) 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 4e3d3092..4799b2fc 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 @@ -1536,7 +1536,6 @@ class STLClient(object): @__api_check(False) def connect (self): """ - def connect(self): Connects to the TRex server @@ -1829,6 +1828,33 @@ class STLClient(object): # return the stream IDs return rc.data() + @__api_check(True) + def add_profile(self, filename, ports = None, **kwargs): + """ | Add streams from profile by its type. Supported types are: + | .py + | .yaml + | .pcap file that converted to profile automatically + + :parameters: + filename : string + filename (with path) of the profile + ports : list + list of ports to add the profile (default: all acquired) + kwargs : dict + forward those key-value pairs to the profile (tunables) + + :returns: + List of stream IDs in order of the stream list + + :raises: + + :exc:`STLError` + + """ + + validate_type('filename', filename, basestring) + profile = STLProfile.load(filename, **kwargs) + return self.add_streams(profile.get_streams(), ports) + @__api_check(True) def remove_streams (self, stream_id_list, ports = None): diff --git a/scripts/automation/trex_perf.py b/scripts/automation/trex_perf.py index 61874765..08d15caf 100755 --- a/scripts/automation/trex_perf.py +++ b/scripts/automation/trex_perf.py @@ -2,13 +2,14 @@ import h_avc -from trex_control_plane.client.trex_client import CTRexClient import ConfigParser import threading import time,signal import argparse import sys import os +sys.path.append(os.path.join('trex_control_plane', 'stf', 'trex_stf_lib')) +from trex_client import CTRexClient import subprocess from time import sleep import signal @@ -54,7 +55,7 @@ class TrexRunException(Exception): def verify_glibc_version (): x = subprocess.check_output("/usr/bin/ldd --version", shell=True) - m = re.match("ldd \(GNU libc\) (.*)", x) + m = re.match("^ldd \([^\)]+\) (.*)", x) if not m: raise Exception("Cannot determine LDD version") current_version = m.group(1) diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index 31e77c92..b961f653 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -659,7 +659,7 @@ static int usage(){ printf(" \n"); printf(" --nc : If set, will not wait for all the flows to be closed, terminate faster- see manual for more information \n"); printf(" \n"); - printf(" -d : duration of the test in sec. look for --nc \n"); + printf(" -d : duration of the test in sec (default is 3600). look also at --nc \n"); printf(" \n"); printf(" -pm : platform factor ,in case you have splitter in the setup you can multiply the total results in this factor \n"); printf(" e.g --pm 2.0 will multiply all the results bps in this factor \n"); @@ -1045,6 +1045,10 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t } if ( get_is_stateless() ) { + if ( po->m_duration ) { + parse_err("Duration is not supported with interactive mode "); + } + if ( po->preview.get_is_rx_check_enable() ) { parse_err("Rx check is not supported with interactive mode "); } @@ -1058,6 +1062,11 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t } } + else { + if ( !po->m_duration ) { + po->m_duration = 3600.0; + } + } return 0; } @@ -1422,12 +1431,7 @@ void CPhyEthIF::tx_queue_setup(uint16_t tx_queue_id, void CPhyEthIF::stop(){ -#if 0 - // allowing this causes bad things to happen. Especially on X710 cards. - // See trex-237 for details rte_eth_dev_stop(m_port_id); - rte_eth_dev_close(m_port_id); -#endif } |