diff options
author | 2016-01-07 23:58:22 +0200 | |
---|---|---|
committer | 2016-01-07 23:58:22 +0200 | |
commit | 8db09096b9dcf030b7dc744fbd7ee463d8e6fd1b (patch) | |
tree | 8de1422ac003e403889b2b248009431aa1176dd3 | |
parent | 7e37a0aabbd351aa899bf7bdb2327eaa61733095 (diff) | |
parent | 79b2a5ea59c3b420988891b9f3751579bfbe8e0e (diff) |
Merge
39 files changed, 2579 insertions, 789 deletions
diff --git a/linux/ws_main.py b/linux/ws_main.py index 71914630..a41fab1e 100755 --- a/linux/ws_main.py +++ b/linux/ws_main.py @@ -257,6 +257,7 @@ bp =SrcGroups([ cxxflags_base =['-DWIN_UCODE_SIM', + '-DTREX_SIM', '-D_BYTE_ORDER', '-D_LITTLE_ENDIAN', '-DLINUX', diff --git a/linux_dpdk/ws_main.py b/linux_dpdk/ws_main.py index 4c8d821d..604b1c1a 100755 --- a/linux_dpdk/ws_main.py +++ b/linux_dpdk/ws_main.py @@ -95,6 +95,7 @@ main_src = SrcGroup(dir='src', 'utl_term_io.cpp', 'global_io_mode.cpp', 'main_dpdk.cpp', + 'debug.cpp', 'bp_sim.cpp', 'latency.cpp', 'platform_cfg.cpp', diff --git a/scripts/automation/regression/aggregate_results.py b/scripts/automation/regression/aggregate_results.py index a3a90fbf..cab19d09 100755 --- a/scripts/automation/regression/aggregate_results.py +++ b/scripts/automation/regression/aggregate_results.py @@ -138,6 +138,64 @@ def add_category_of_tests(category, tests, hidden = False, category_info_dir = N html_output += '\n</table>\n</div>' return html_output +style_css = """ +html {overflow-y:scroll;} + +body { + font-size:12px; + color:#000000; + background-color:#ffffff; + margin:0px; + font-family:verdana,helvetica,arial,sans-serif; +} + +div {width:100%;} + +table,th,td,input,textarea { + font-size:100%; +} + +table.reference, table.reference_fail { + background-color:#ffffff; + border:1px solid #c3c3c3; + border-collapse:collapse; + vertical-align:middle; +} + +table.reference th { + background-color:#e5eecc; + border:1px solid #c3c3c3; + padding:3px; +} + +table.reference_fail th { + background-color:#ffcccc; + border:1px solid #c3c3c3; + padding:3px; +} + + +table.reference td, table.reference_fail td { + border:1px solid #c3c3c3; + padding:3px; +} + +a.example {font-weight:bold} + +#a:link,a:visited {color:#900B09; background-color:transparent} +#a:hover,a:active {color:#FF0000; background-color:transparent} + +.linktr { + cursor: pointer; +} + +.linktext { + color:#0000FF; + text-decoration: underline; +} +""" + + # main if __name__ == '__main__': @@ -276,8 +334,6 @@ if __name__ == '__main__': <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style type="text/css"> ''' - with open('style.css') as f: - style_css = f.read() html_output += style_css html_output +=''' </style> diff --git a/scripts/automation/regression/misc_methods.py b/scripts/automation/regression/misc_methods.py index f736d805..2341b9be 100755 --- a/scripts/automation/regression/misc_methods.py +++ b/scripts/automation/regression/misc_methods.py @@ -38,7 +38,7 @@ def run_remote_command(host, passwd, command_string): return_code, stdout, stderr = run_command(cmd) if return_code == 0: return (return_code, stdout, stderr) - else: + elif passwd is not None: print 'Trying connection with expect + sshpass.exp...' cmd = 'sshpass.exp %s %s root "%s"' % (passwd, host, command_string) return_code, stdout, stderr = run_command(cmd) @@ -128,7 +128,7 @@ def load_complete_config_file (filepath): # Handle T-Rex configuration trex_config['trex_name'] = config["trex"]["hostname"] - trex_config['trex_password'] = config["trex"]["password"] + trex_config['trex_password'] = config["trex"].get("password") #trex_config['trex_is_dual'] = config["trex"]["is_dual"] trex_config['trex_cores'] = int(config["trex"]["cores"]) #trex_config['trex_latency'] = int(config["trex"]["latency"]) diff --git a/scripts/automation/regression/reports/.keep b/scripts/automation/regression/reports/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/scripts/automation/regression/reports/.keep diff --git a/scripts/automation/regression/setups/dave/benchmark.yaml b/scripts/automation/regression/setups/dave/benchmark.yaml new file mode 100755 index 00000000..0427f9a1 --- /dev/null +++ b/scripts/automation/regression/setups/dave/benchmark.yaml @@ -0,0 +1,118 @@ +################################################################ +#### T-Rex benchmark configuration file #### +################################################################ + +test_nbar_simple : + multiplier : 0.5 + cores : 4 + exp_gbps : 0.5 + cpu_to_core_ratio : 37270000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + exp_max_latency : 1000 + + nbar_classification: + http : 29.95 + rtp_audio : 20.75 + oracle_sqlnet : 11.09 + rtp : 10.9 + exchange : 8.16 + citrix : 5.54 + rtsp : 2.85 + sctp : 3.83 + ssl : 2.41 + sip : 0.09 + dns : 1.92 + smtp : 0.56 + pop3 : 0.36 + unknown : 3.15 + +test_rx_check : + multiplier : 25 + cores : 4 + rx_sample_rate : 128 + exp_gbps : 0.5 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + +test_nat_simple : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + nat_dict : + clients_net_start : 16.0.0.0 + client_acl_wildcard_mask : 0.0.0.255 + dual_port_mask : 1.0.0.0 + pool_start : 200.0.0.0 + pool_netmask : 255.255.255.0 + multiplier : 400 + cpu_to_core_ratio : 37270000 + cores : 4 + exp_bw : 1 + exp_latency : 1 + allow_timeout_dev : YES + +test_nat_learning : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 400 + cores : 4 + nat_opened : 100000 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + allow_timeout_dev : YES + +test_routing_imix_64 : + multiplier : 2500 + cores : 4 + cpu_to_core_ratio : 8900 + exp_latency : 1 + +test_routing_imix : + multiplier : 70 + cores : 2 + cpu_to_core_ratio : 8900 + exp_latency : 1 + +test_static_routing_imix : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 70 + cores : 2 + cpu_to_core_ratio : 3766666 + exp_latency : 1 + +test_static_routing_imix_asymmetric: + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 36 + cores : 1 + cpu_to_core_ratio : 3766666 + exp_latency : 1 + +test_ipv6_simple : + multiplier : 36 + cores : 4 + cpu_to_core_ratio : 30070000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + + + diff --git a/scripts/automation/regression/setups/dave/config.yaml b/scripts/automation/regression/setups/dave/config.yaml new file mode 100755 index 00000000..66e92097 --- /dev/null +++ b/scripts/automation/regression/setups/dave/config.yaml @@ -0,0 +1,94 @@ +################################################################ +#### T-Rex nightly test configuration file #### +################################################################ + + +### T-Rex configuration: +# hostname - can be DNS name or IP for the TRex machine for ssh to the box +# password - root password for TRex machine +# is_dual - should the TRex inject with -p ? +# version_path - path to the t-rex version and executable +# cores - how many cores should be used +# latency - rate of latency packets injected by the TRex +# modes - list of modes (tagging) of this setup (loopback, virtual etc.) +# * loopback - Trex works via loopback. Router and TFTP configurations may be skipped. +# * virtual - virtual OS (accept low CPU utilization in tests) + +### Router configuration: +# hostname - the router hostname as apears in ______# cli prefix +# ip_address - the router's ip that can be used to communicate with +# image - the desired imaged wished to be loaded as the router's running config +# line_password - router password when access via Telent +# en_password - router password when changing to "enable" mode +# interfaces - an array of client-server pairs, representing the interfaces configurations of the router +# configurations - an array of configurations that could possibly loaded into the router during the test. +# The "clean" configuration is a mandatory configuration the router will load with to run the basic test bench + +### TFTP configuration: +# hostname - the tftp hostname +# ip_address - the tftp's ip address +# images_path - the tftp's relative path in which the router's images are located + +### Test_misc configuration: +# expected_bw - the "golden" bandwidth (in Gbps) results planned on receiving from the test + +trex: + hostname : cpp-rtp-trex-01 + cores : 4 + +router: + model : ESP100 + hostname : cpp-rtp-ts-15 + ip_address : 172.18.4.34 + port : 2054 + image : trex_regression_v155_315.bin + line_password : cisco + en_password : cisco + mgmt_interface : dummy + clean_config : dummy + intf_masking : 255.255.255.0 + ipv6_mask : 64 + interfaces : + - client : + name : TenGigabitEthernet0/0/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : TenGigabitEthernet0/1/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : + - client : + name : TenGigabitEthernet0/2/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : TenGigabitEthernet0/3/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : + - client : + name : TenGigabitEthernet1/0/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : TenGigabitEthernet1/1/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : + - client : + name : TenGigabitEthernet1/2/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : TenGigabitEthernet1/3/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : + + +tftp: + hostname : ats-asr-srv-1 + ip_address : 10.56.128.23 + root_dir : /auto/avc-devtest/images/ + images_path : /images/RP1/ diff --git a/scripts/automation/regression/setups/dummy/config.yaml b/scripts/automation/regression/setups/dummy/config.yaml new file mode 100644 index 00000000..8426ec6c --- /dev/null +++ b/scripts/automation/regression/setups/dummy/config.yaml @@ -0,0 +1,11 @@ +################################################################ +#### T-Rex nightly test configuration file #### +################################################################ + + +# dummy setup, all Trex tests are expected to be skipped + +trex: + hostname : csi-trex-04 + cores : 2 + modes : [loopback, virtual, dummy_mode] diff --git a/scripts/automation/regression/setups/kiwi02/benchmark.yaml b/scripts/automation/regression/setups/kiwi02/benchmark.yaml new file mode 100644 index 00000000..b50662e1 --- /dev/null +++ b/scripts/automation/regression/setups/kiwi02/benchmark.yaml @@ -0,0 +1,138 @@ +################################################################ +#### T-Rex benchmark configuration file #### +################################################################ + +test_nbar_simple : + multiplier : 20 + cores : 2 + exp_gbps : 4.5 + cpu_to_core_ratio : 37270000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + exp_max_latency : 1000 + + nbar_classification: + http : 30.41 + rtp_audio : 21.22 + rtp : 11.4 + oracle_sqlnet : 11.3 + exchange : 10.95 + citrix : 5.65 + rtsp : 2.67 + dns : 1.95 + smtp : 0.57 + pop3 : 0.36 + sctp : 0.09 + sip : 0.09 + ssl : 0.06 + unknown : 3.2 + +test_rx_check : + multiplier : 25 + cores : 4 + rx_sample_rate : 128 + exp_gbps : 0.5 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + +test_nat_simple : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + nat_dict : + clients_net_start : 16.0.0.0 + client_acl_wildcard_mask : 0.0.0.255 + dual_port_mask : 1.0.0.0 + pool_start : 200.0.0.0 + pool_netmask : 255.255.255.0 + multiplier : 400 + cpu_to_core_ratio : 37270000 + cores : 4 + exp_bw : 1 + exp_latency : 1 + allow_timeout_dev : YES + +test_nat_learning : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 400 + cores : 4 + nat_opened : 100000 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + allow_timeout_dev : YES + +test_routing_imix_64 : + multiplier : 2500 + cores : 4 + cpu_to_core_ratio : 8900 + exp_latency : 1 + +test_routing_imix : + multiplier : 36 + cores : 4 + cpu_to_core_ratio : 8900 + exp_latency : 1 + +test_static_routing_imix : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 36 + cores : 4 + cpu_to_core_ratio : 3766666 + exp_latency : 1 + +test_static_routing_imix_asymmetric: + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 19 + cores : 4 + cpu_to_core_ratio : 3766666 + exp_latency : 1 + +test_ipv6_simple : + multiplier : 36 + cores : 4 + cpu_to_core_ratio : 30070000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + + +test_rx_check_sfr: + multiplier : 25 + cores : 4 + rx_sample_rate : 32 + +test_rx_check_http: + multiplier : 40000 + cores : 2 + rx_sample_rate : 32 + +test_rx_check_sfr_ipv6: + multiplier : 25 + cores : 4 + rx_sample_rate : 32 + +test_rx_check_http_ipv6: + multiplier : 40000 + cores : 2 + rx_sample_rate : 32 + + diff --git a/scripts/automation/regression/setups/kiwi02/config.yaml b/scripts/automation/regression/setups/kiwi02/config.yaml new file mode 100644 index 00000000..1154b558 --- /dev/null +++ b/scripts/automation/regression/setups/kiwi02/config.yaml @@ -0,0 +1,95 @@ +################################################################ +#### T-Rex nightly test configuration file #### +################################################################ + + +### T-Rex configuration: +# hostname - can be DNS name or IP for the TRex machine for ssh to the box +# password - root password for TRex machine +# is_dual - should the TRex inject with -p ? +# version_path - path to the t-rex version and executable +# cores - how many cores should be used +# latency - rate of latency packets injected by the TRex +# modes - list of modes (tagging) of this setup (loopback, virtual etc.) +# * loopback - Trex works via loopback. Router and TFTP configurations may be skipped. +# * VM - Virtual OS (accept low CPU utilization in tests, latency can get spikes) +# * virt_nics - NICs are virtual (VMXNET3 etc.) + +### Router configuration: +# hostname - the router hostname as apears in ______# cli prefix +# ip_address - the router's ip that can be used to communicate with +# image - the desired imaged wished to be loaded as the router's running config +# line_password - router password when access via Telent +# en_password - router password when changing to "enable" mode +# interfaces - an array of client-server pairs, representing the interfaces configurations of the router +# configurations - an array of configurations that could possibly loaded into the router during the test. +# The "clean" configuration is a mandatory configuration the router will load with to run the basic test bench + +### TFTP configuration: +# hostname - the tftp hostname +# ip_address - the tftp's ip address +# images_path - the tftp's relative path in which the router's images are located + +### Test_misc configuration: +# expected_bw - the "golden" bandwidth (in Gbps) results planned on receiving from the test + +trex: + hostname : 10.56.217.210 #10.56.192.189 + cores : 4 + +router: + model : ESP100 + hostname : csi-mcp-asr1k-40 + ip_address : 10.56.192.57 + image : BLD_V155_2_S_XE315_THROTTLE_LATEST_20150424_100040-std.bin # is in harddisk of router + #image : asr1000rp2-adventerprisek9.2014-11-10_18.33_etis.bin + line_password : cisco + en_password : cisco + mgmt_interface : GigabitEthernet0 + clean_config : /tmp/asr1001_TRex_clean_config.cfg + intf_masking : 255.255.255.0 + ipv6_mask : 64 + interfaces : + - client : + name : TenGigabitEthernet0/0/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : TenGigabitEthernet0/1/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : duplicate + - client : + name : TenGigabitEthernet0/2/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : TenGigabitEthernet0/3/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : duplicate + - client : + name : TenGigabitEthernet1/0/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : TenGigabitEthernet1/1/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : + - client : + name : TenGigabitEthernet1/2/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : TenGigabitEthernet1/3/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : + + +tftp: + hostname : kiwi02_tftp_server + ip_address : 10.56.217.7 + root_dir : /scratch/tftp/ + images_path : hhaim/ diff --git a/scripts/automation/regression/setups/trex-dan/benchmark.yaml b/scripts/automation/regression/setups/trex-dan/benchmark.yaml new file mode 100644 index 00000000..419fe7b3 --- /dev/null +++ b/scripts/automation/regression/setups/trex-dan/benchmark.yaml @@ -0,0 +1,153 @@ +############################################################### +#### TRex benchmark configuration file #### +############################################################### + +test_nbar_simple : + multiplier : 1.5 + cores : 1 + exp_gbps : 0.5 + cpu_to_core_ratio : 20800000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + exp_max_latency : 1000 + + nbar_classification: + http : 30.3 + rtp_audio : 21.06 + oracle_sqlnet : 11.25 + rtp : 11.1 + exchange : 10.16 + citrix : 5.6 + rtsp : 2.84 + sctp : 0.65 + ssl : 0.8 + sip : 0.09 + dns : 1.95 + smtp : 0.57 + pop3 : 0.36 + unknown : 3.19 + +test_rx_check : + multiplier : 0.8 + cores : 1 + rx_sample_rate : 128 + exp_gbps : 0.5 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + +test_nat_simple : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + nat_dict : + clients_net_start : 16.0.0.0 + client_acl_wildcard_mask : 0.0.0.255 + dual_port_mask : 1.0.0.0 + pool_start : 200.0.0.0 + pool_netmask : 255.255.255.0 + multiplier : 150 + cores : 1 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + allow_timeout_dev : YES + +test_nat_learning : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 150 + cores : 1 + nat_opened : 40000 + cpu_to_core_ratio : 270 + exp_bw : 1 + exp_latency : 1 + allow_timeout_dev : YES + +test_routing_imix_64 : + multiplier : 28 + cores : 1 + cpu_to_core_ratio : 280 + exp_latency : 1 + +test_routing_imix : + multiplier : 1 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 0.7 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix_asymmetric: + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 0.8 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_ipv6_simple : + multiplier : 1.5 + cores : 1 + cpu_to_core_ratio : 30070000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + + +test_rx_check_sfr: + multiplier : 1.7 + cores : 2 + rx_sample_rate : 16 + +test_rx_check_http: + multiplier : 2200 + cores : 1 + rx_sample_rate : 16 + +test_rx_check_sfr_ipv6: + multiplier : 1.7 + cores : 2 + rx_sample_rate : 16 + +test_rx_check_http_ipv6: + multiplier : 2200 + cores : 1 + rx_sample_rate : 16 + +test_rx_check_http_negative: + multiplier : 2200 + cores : 1 + rx_sample_rate : 16 + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + nat_dict : + clients_net_start : 16.0.0.0 + client_acl_wildcard_mask : 0.0.0.255 + dual_port_mask : 1.0.0.0 + pool_start : 200.0.0.0 + pool_netmask : 255.255.255.0
\ No newline at end of file diff --git a/scripts/automation/regression/setups/trex-dan/config.yaml b/scripts/automation/regression/setups/trex-dan/config.yaml new file mode 100644 index 00000000..ae60f9ad --- /dev/null +++ b/scripts/automation/regression/setups/trex-dan/config.yaml @@ -0,0 +1,69 @@ +################################################################ +#### T-Rex nightly test configuration file #### +################################################################ + + +### T-Rex configuration: +# hostname - can be DNS name or IP for the TRex machine for ssh to the box +# is_dual - should the TRex inject with -p ? +# version_path - path to the t-rex version and executable +# cores - how many cores should be used +# latency - rate of latency packets injected by the TRex +# modes - list of modes (tagging) of this setup (loopback, virtual etc.) +# * loopback - Trex works via loopback. Router and TFTP configurations may be skipped. +# * VM - Virtual OS (accept low CPU utilization in tests, latency can get spikes) +# * virt_nics - NICs are virtual (VMXNET3 etc.) + +### Router configuration: +# hostname - the router hostname as apears in ______# cli prefix +# ip_address - the router's ip that can be used to communicate with +# image - the desired imaged wished to be loaded as the router's running config +# line_password - router password when access via Telent +# en_password - router password when changing to "enable" mode +# interfaces - an array of client-server pairs, representing the interfaces configurations of the router +# configurations - an array of configurations that could possibly loaded into the router during the test. +# The "clean" configuration is a mandatory configuration the router will load with to run the basic test bench + +### TFTP configuration: +# hostname - the tftp hostname +# ip_address - the tftp's ip address +# images_path - the tftp's relative path in which the router's images are located + +### Test_misc configuration: +# expected_bw - the "golden" bandwidth (in Gbps) results planned on receiving from the test + +trex: + hostname : trex-dan +# version_path : /auto/proj-pcube-b/apps/PL-b/tools/bp_sim2/v1.57/ #/auto/srg-sce-swinfra-usr/emb/users/danklei/Work/asr1k/emb/private/bpsim/main/scripts + cores : 2 + modes : [VM] + +router: + model : 1RU + hostname : ASR1001_T-Rex + ip_address : 10.56.199.247 + image : asr1001-universalk9.BLD_V155_1_S_XE314_THROTTLE_LATEST_20141112_090734-std.bin + #image : asr1001-universalk9.BLD_V155_2_S_XE315_THROTTLE_LATEST_20150121_110036-std.bin + #image : asr1001-universalk9.BLD_V155_2_S_XE315_THROTTLE_LATEST_20150324_100047-std.bin + line_password : lab + en_password : lab + mgmt_interface : GigabitEthernet0/0/0 + clean_config : /Configurations/danklei/asr1001_TRex_clean_config.cfg + intf_masking : 255.255.255.0 + ipv6_mask : 64 + interfaces : + - client : + name : GigabitEthernet0/0/1 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : GigabitEthernet0/0/2 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : null + +tftp: + hostname : ats-asr-srv-1 + ip_address : 10.56.128.23 + root_dir : /auto/avc-devtest/ + images_path : /images/1RU/ diff --git a/scripts/automation/regression/setups/trex04/benchmark.yaml b/scripts/automation/regression/setups/trex04/benchmark.yaml new file mode 100644 index 00000000..d448910e --- /dev/null +++ b/scripts/automation/regression/setups/trex04/benchmark.yaml @@ -0,0 +1,60 @@ +################################################################ +#### T-Rex benchmark configuration file #### +################################################################ + + +test_rx_check : + multiplier : 0.8 + cores : 1 + rx_sample_rate : 128 + exp_gbps : 0.5 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + + +test_routing_imix_64 : + multiplier : 28 + cores : 1 + cpu_to_core_ratio : 280 + exp_latency : 1 + +test_routing_imix : + multiplier : 0.8 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 0.8 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix_asymmetric: + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 0.8 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_ipv6_simple : + multiplier : 0.5 + cores : 1 + cpu_to_core_ratio : 30070000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + + + diff --git a/scripts/automation/regression/setups/trex04/config.yaml b/scripts/automation/regression/setups/trex04/config.yaml new file mode 100644 index 00000000..f9cc21df --- /dev/null +++ b/scripts/automation/regression/setups/trex04/config.yaml @@ -0,0 +1,39 @@ +################################################################ +#### T-Rex nightly test configuration file #### +################################################################ + + +### T-Rex configuration: +# hostname - can be DNS name or IP for the TRex machine for ssh to the box +# password - root password for TRex machine +# is_dual - should the TRex inject with -p ? +# version_path - path to the t-rex version and executable +# cores - how many cores should be used +# latency - rate of latency packets injected by the Trex +# modes - list of modes (tagging) of this setup (loopback, virtual etc.) +# * loopback - Trex works via loopback. Router and TFTP configurations may be skipped. +# * VM - Virtual OS (accept low CPU utilization in tests, latency can get spikes) +# * virt_nics - NICs are virtual (VMXNET3 etc. have their limitations in tests) + +### Router configuration: +# hostname - the router hostname as apears in ______# cli prefix +# ip_address - the router's ip that can be used to communicate with +# image - the desired imaged wished to be loaded as the router's running config +# line_password - router password when access via Telent +# en_password - router password when changing to "enable" mode +# interfaces - an array of client-server pairs, representing the interfaces configurations of the router +# configurations - an array of configurations that could possibly loaded into the router during the test. +# The "clean" configuration is a mandatory configuration the router will load with to run the basic test bench + +### TFTP configuration: +# hostname - the tftp hostname +# ip_address - the tftp's ip address +# images_path - the tftp's relative path in which the router's images are located + +### Test_misc configuration: +# expected_bw - the "golden" bandwidth (in Gbps) results planned on receiving from the test + +trex: + hostname : csi-trex-04 + cores : 2 + modes : [loopback, virt_nics, VM] diff --git a/scripts/automation/regression/setups/trex08/benchmark.yaml b/scripts/automation/regression/setups/trex08/benchmark.yaml new file mode 100644 index 00000000..3676abf3 --- /dev/null +++ b/scripts/automation/regression/setups/trex08/benchmark.yaml @@ -0,0 +1,37 @@ +############################################################### +#### TRex benchmark configuration file #### +############################################################### + +test_routing_imix_64 : + multiplier : 8000 + cores : 7 + cpu_to_core_ratio : 280 + exp_latency : 1 + +test_routing_imix : + multiplier : 80 + cores : 4 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix_asymmetric: + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 70 + cores : 3 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_ipv6_simple : + multiplier : 80 + cores : 7 + cpu_to_core_ratio : 30070000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + + + diff --git a/scripts/automation/regression/setups/trex08/config.yaml b/scripts/automation/regression/setups/trex08/config.yaml new file mode 100644 index 00000000..fd3a6a78 --- /dev/null +++ b/scripts/automation/regression/setups/trex08/config.yaml @@ -0,0 +1,40 @@ +################################################################ +#### T-Rex nightly test configuration file #### +################################################################ + + +### T-Rex configuration: +# hostname - can be DNS name or IP for the TRex machine for ssh to the box +# password - root password for TRex machine +# is_dual - should the TRex inject with -p ? +# version_path - path to the t-rex version and executable +# cores - how many cores should be used +# latency - rate of latency packets injected by the TRex +# modes - list of modes (tagging) of this setup (loopback etc.) +# * loopback - Trex works via loopback. Router and TFTP configurations may be skipped. +# * VM - Virtual OS (accept low CPU utilization in tests, latency can get spikes) +# * virt_nics - NICs are virtual (VMXNET3 etc.) + +### Router configuration: +# hostname - the router hostname as apears in ______# cli prefix +# ip_address - the router's ip that can be used to communicate with +# image - the desired imaged wished to be loaded as the router's running config +# line_password - router password when access via Telent +# en_password - router password when changing to "enable" mode +# interfaces - an array of client-server pairs, representing the interfaces configurations of the router +# configurations - an array of configurations that could possibly loaded into the router during the test. +# The "clean" configuration is a mandatory configuration the router will load with to run the basic test bench + +### TFTP configuration: +# hostname - the tftp hostname +# ip_address - the tftp's ip address +# images_path - the tftp's relative path in which the router's images are located + +### Test_misc configuration: +# expected_bw - the "golden" bandwidth (in Gbps) results planned on receiving from the test + +trex: + hostname : csi-trex-08 + cores : 2 + modes : ['loopback'] + diff --git a/scripts/automation/regression/setups/trex09/benchmark.yaml b/scripts/automation/regression/setups/trex09/benchmark.yaml new file mode 100644 index 00000000..3f7b9a95 --- /dev/null +++ b/scripts/automation/regression/setups/trex09/benchmark.yaml @@ -0,0 +1,118 @@ +############################################################### +#### TRex benchmark configuration file #### +############################################################### + +test_nbar_simple : + multiplier : 1.5 + cores : 1 + exp_gbps : 0.5 + cpu_to_core_ratio : 20800000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + exp_max_latency : 1000 + + nbar_classification: + http : 30.3 + rtp_audio : 21.06 + oracle_sqlnet : 11.25 + rtp : 11.1 + exchange : 10.16 + citrix : 5.6 + rtsp : 2.84 + sctp : 0.65 + ssl : 0.8 + sip : 0.09 + dns : 1.95 + smtp : 0.57 + pop3 : 0.36 + unknown : 3.19 + +test_rx_check : + multiplier : 0.8 + cores : 1 + rx_sample_rate : 128 + exp_gbps : 0.5 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + +test_nat_simple : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + nat_dict : + clients_net_start : 16.0.0.0 + client_acl_wildcard_mask : 0.0.0.255 + dual_port_mask : 1.0.0.0 + pool_start : 200.0.0.0 + pool_netmask : 255.255.255.0 + multiplier : 150 + cores : 1 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + allow_timeout_dev : YES + +test_nat_learning : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 150 + cores : 1 + nat_opened : 40000 + cpu_to_core_ratio : 270 + exp_bw : 1 + exp_latency : 1 + allow_timeout_dev : YES + +test_routing_imix_64 : + multiplier : 28 + cores : 1 + cpu_to_core_ratio : 280 + exp_latency : 1 + +test_routing_imix : + multiplier : 1 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 0.7 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix_asymmetric: + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 0.8 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_ipv6_simple : + multiplier : 1.5 + cores : 1 + cpu_to_core_ratio : 30070000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + + + diff --git a/scripts/automation/regression/setups/trex09/config.yaml b/scripts/automation/regression/setups/trex09/config.yaml new file mode 100644 index 00000000..9820ce6e --- /dev/null +++ b/scripts/automation/regression/setups/trex09/config.yaml @@ -0,0 +1,67 @@ +################################################################ +#### T-Rex nightly test configuration file #### +################################################################ + + +### T-Rex configuration: +# hostname - can be DNS name or IP for the TRex machine for ssh to the box +# password - root password for TRex machine +# is_dual - should the TRex inject with -p ? +# version_path - path to the t-rex version and executable +# cores - how many cores should be used +# latency - rate of latency packets injected by the TRex +# modes - list of modes (tagging) of this setup (loopback, virtual etc.) +# * loopback - Trex works via loopback. Router and TFTP configurations may be skipped. +# * virtual - virtual OS (accept low CPU utilization in tests) + +### Router configuration: +# hostname - the router hostname as apears in ______# cli prefix +# ip_address - the router's ip that can be used to communicate with +# image - the desired imaged wished to be loaded as the router's running config +# line_password - router password when access via Telent +# en_password - router password when changing to "enable" mode +# interfaces - an array of client-server pairs, representing the interfaces configurations of the router +# configurations - an array of configurations that could possibly loaded into the router during the test. +# The "clean" configuration is a mandatory configuration the router will load with to run the basic test bench + +### TFTP configuration: +# hostname - the tftp hostname +# ip_address - the tftp's ip address +# images_path - the tftp's relative path in which the router's images are located + +### Test_misc configuration: +# expected_bw - the "golden" bandwidth (in Gbps) results planned on receiving from the test + +trex: + hostname : csi-trex-09 + cores : 2 + +router: + model : 1RU + hostname : ASR1001_T-Rex + ip_address : 10.56.199.247 + image : asr1001-universalk9.BLD_V155_1_S_XE314_THROTTLE_LATEST_20141112_090734-std.bin + #image : asr1001-universalk9.BLD_V155_2_S_XE315_THROTTLE_LATEST_20150121_110036-std.bin + #image : asr1001-universalk9.BLD_V155_2_S_XE315_THROTTLE_LATEST_20150324_100047-std.bin + line_password : lab + en_password : lab + mgmt_interface : GigabitEthernet0/0/0 + clean_config : /Configurations/danklei/asr1001_TRex_clean_config.cfg + intf_masking : 255.255.255.0 + ipv6_mask : 64 + interfaces : + - client : + name : GigabitEthernet0/0/1 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : GigabitEthernet0/0/2 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : null + +tftp: + hostname : ats-asr-srv-1 + ip_address : 10.56.128.23 + root_dir : /auto/avc-devtest/ + images_path : /images/1RU/ diff --git a/scripts/automation/regression/setups/trex10/benchmark.yaml b/scripts/automation/regression/setups/trex10/benchmark.yaml new file mode 100644 index 00000000..999eff3d --- /dev/null +++ b/scripts/automation/regression/setups/trex10/benchmark.yaml @@ -0,0 +1,60 @@ +################################################################ +#### T-Rex benchmark configuration file #### +################################################################ + + +test_rx_check : + multiplier : 0.8 + cores : 1 + rx_sample_rate : 128 + exp_gbps : 0.5 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + + +test_routing_imix_64 : + multiplier : 37 + cores : 1 + cpu_to_core_ratio : 280 + exp_latency : 1 + +test_routing_imix : + multiplier : 0.8 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 0.8 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix_asymmetric: + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 0.8 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_ipv6_simple : + multiplier : 0.5 + cores : 1 + cpu_to_core_ratio : 30070000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + + + diff --git a/scripts/automation/regression/setups/trex10/config.yaml b/scripts/automation/regression/setups/trex10/config.yaml new file mode 100644 index 00000000..093911a9 --- /dev/null +++ b/scripts/automation/regression/setups/trex10/config.yaml @@ -0,0 +1,38 @@ +################################################################ +#### T-Rex nightly test configuration file #### +################################################################ + + +### T-Rex configuration: +# hostname - can be DNS name or IP for the TRex machine for ssh to the box +# password - root password for TRex machine +# is_dual - should the TRex inject with -p ? +# version_path - path to the t-rex version and executable +# cores - how many cores should be used +# latency - rate of latency packets injected by the Trex +# modes - list of modes (tagging) of this setup (loopback, virtual etc.) +# * loopback - Trex works via loopback. Router and TFTP configurations may be skipped. +# * virtual - virtual OS (accept low CPU utilization in tests) + +### Router configuration: +# hostname - the router hostname as apears in ______# cli prefix +# ip_address - the router's ip that can be used to communicate with +# image - the desired imaged wished to be loaded as the router's running config +# line_password - router password when access via Telent +# en_password - router password when changing to "enable" mode +# interfaces - an array of client-server pairs, representing the interfaces configurations of the router +# configurations - an array of configurations that could possibly loaded into the router during the test. +# The "clean" configuration is a mandatory configuration the router will load with to run the basic test bench + +### TFTP configuration: +# hostname - the tftp hostname +# ip_address - the tftp's ip address +# images_path - the tftp's relative path in which the router's images are located + +### Test_misc configuration: +# expected_bw - the "golden" bandwidth (in Gbps) results planned on receiving from the test + +trex: + hostname : csi-trex-10 + cores : 2 + modes : [loopback, virtual] diff --git a/scripts/automation/regression/setups/trex11/benchmark.yaml b/scripts/automation/regression/setups/trex11/benchmark.yaml new file mode 100644 index 00000000..7280cede --- /dev/null +++ b/scripts/automation/regression/setups/trex11/benchmark.yaml @@ -0,0 +1,133 @@ +############################################################### +#### TRex benchmark configuration file #### +############################################################### + +test_nbar_simple : + multiplier : 1.5 + cores : 1 + exp_gbps : 0.5 + cpu_to_core_ratio : 20800000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + exp_max_latency : 1000 + + nbar_classification: + http : 30.3 + rtp_audio : 21.06 + oracle_sqlnet : 11.25 + rtp : 11.1 + exchange : 10.16 + citrix : 5.6 + rtsp : 2.84 + sctp : 0.65 + ssl : 0.8 + sip : 0.09 + dns : 1.95 + smtp : 0.57 + pop3 : 0.36 + unknown : 3.19 + +test_rx_check : + multiplier : 0.8 + cores : 1 + rx_sample_rate : 128 + exp_gbps : 0.5 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + +test_nat_simple : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + nat_dict : + clients_net_start : 16.0.0.0 + client_acl_wildcard_mask : 0.0.0.255 + dual_port_mask : 1.0.0.0 + pool_start : 200.0.0.0 + pool_netmask : 255.255.255.0 + multiplier : 150 + cores : 1 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + allow_timeout_dev : YES + +test_nat_learning : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 150 + cores : 1 + nat_opened : 40000 + cpu_to_core_ratio : 270 + exp_bw : 1 + exp_latency : 1 + allow_timeout_dev : YES + +test_routing_imix_64 : + multiplier : 28 + cores : 1 + cpu_to_core_ratio : 280 + exp_latency : 1 + +test_routing_imix : + multiplier : 1 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 0.7 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix_asymmetric: + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 0.8 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_ipv6_simple : + multiplier : 1.5 + cores : 1 + cpu_to_core_ratio : 30070000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + +test_rx_check_http_negative: + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + nat_dict : + clients_net_start : 16.0.0.0 + client_acl_wildcard_mask : 0.0.0.255 + dual_port_mask : 1.0.0.0 + pool_start : 200.0.0.0 + pool_netmask : 255.255.255.0 + multiplier : 4000 + cores : 1 + rx_sample_rate : 32 + diff --git a/scripts/automation/regression/setups/trex11/config.yaml b/scripts/automation/regression/setups/trex11/config.yaml new file mode 100644 index 00000000..876a1afd --- /dev/null +++ b/scripts/automation/regression/setups/trex11/config.yaml @@ -0,0 +1,69 @@ +################################################################ +#### T-Rex nightly test configuration file #### +################################################################ + + +### T-Rex configuration: +# hostname - can be DNS name or IP for the TRex machine for ssh to the box +# password - root password for TRex machine +# is_dual - should the TRex inject with -p ? +# version_path - path to the t-rex version and executable +# cores - how many cores should be used +# latency - rate of latency packets injected by the TRex +# modes - list of modes (tagging) of this setup (loopback, virtual etc.) +# * loopback - Trex works via loopback. Router and TFTP configurations may be skipped. +# * virtual - virtual OS (accept low CPU utilization in tests) + +### Router configuration: +# hostname - the router hostname as apears in ______# cli prefix +# ip_address - the router's ip that can be used to communicate with +# image - the desired imaged wished to be loaded as the router's running config +# line_password - router password when access via Telent +# en_password - router password when changing to "enable" mode +# interfaces - an array of client-server pairs, representing the interfaces configurations of the router +# configurations - an array of configurations that could possibly loaded into the router during the test. +# The "clean" configuration is a mandatory configuration the router will load with to run the basic test bench + +### TFTP configuration: +# hostname - the tftp hostname +# ip_address - the tftp's ip address +# images_path - the tftp's relative path in which the router's images are located + +### Test_misc configuration: +# expected_bw - the "golden" bandwidth (in Gbps) results planned on receiving from the test + +trex: + hostname : csi-trex-11 + cores : 2 + modes : ['loopback', 'virtual'] + +router: + model : 1RU + hostname : ASR1001_T-Rex +# ip_address : 10.56.199.247 + ip_address : 10.56.199.247123123123 + image : asr1001-universalk9.BLD_V155_1_S_XE314_THROTTLE_LATEST_20141112_090734-std.bin + #image : asr1001-universalk9.BLD_V155_2_S_XE315_THROTTLE_LATEST_20150121_110036-std.bin + #image : asr1001-universalk9.BLD_V155_2_S_XE315_THROTTLE_LATEST_20150324_100047-std.bin + line_password : lab + en_password : lab + mgmt_interface : GigabitEthernet0/0/0 + clean_config : /Configurations/danklei/asr1001_TRex_clean_config.cfg + intf_masking : 255.255.255.0 + ipv6_mask : 64 + interfaces : + - client : + name : GigabitEthernet0/0/1 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : GigabitEthernet0/0/2 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : null + +tftp: + hostname : ats-asr-srv-1 + ip_address : 10.56.128.23 + root_dir : /auto/avc-devtest/ + images_path : /images/1RU/ diff --git a/scripts/automation/regression/setups/trex12/benchmark.yaml b/scripts/automation/regression/setups/trex12/benchmark.yaml new file mode 100644 index 00000000..98f7215e --- /dev/null +++ b/scripts/automation/regression/setups/trex12/benchmark.yaml @@ -0,0 +1,161 @@ +############################################################### +#### TRex benchmark configuration file #### +############################################################### + +test_nbar_simple : + multiplier : 7.5 + cores : 2 + exp_gbps : 3.5 + cpu_to_core_ratio : 20800000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + exp_max_latency : 1000 + + nbar_classification: + http : 30.18 + rtp-audio : 21.27 + rtp : 11.26 + oracle_sqlnet : 11.2 + exchange : 10.78 + citrix : 5.61 + rtsp : 2.82 + dns : 1.94 + smtp : 0.57 + pop3 : 0.36 + ssl : 0.16 + sctp : 0.13 + sip : 0.09 + unknown : 3.54 + +test_rx_check : + multiplier : 13 + cores : 4 + rx_sample_rate : 128 + exp_gbps : 6 + cpu_to_core_ratio : 37270000 + exp_bw : 13 + exp_latency : 1 + +test_nat_simple : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + nat_dict : + clients_net_start : 16.0.0.0 + client_acl_wildcard_mask : 0.0.0.255 + dual_port_mask : 1.0.0.0 + pool_start : 200.0.0.0 + pool_netmask : 255.255.255.0 + multiplier : 12000 + cores : 1 + cpu_to_core_ratio : 37270000 + exp_bw : 1 + exp_latency : 1 + allow_timeout_dev : YES + +test_nat_learning : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 12000 + cores : 1 + nat_opened : 40000 + cpu_to_core_ratio : 270 + exp_bw : 8 + exp_latency : 1 + allow_timeout_dev : YES + +test_routing_imix_64 : + multiplier : 430 + cores : 1 + cpu_to_core_ratio : 280 + exp_latency : 1 + +test_routing_imix : + multiplier : 10 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix : + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 10 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_static_routing_imix_asymmetric: + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + multiplier : 8 + cores : 1 + cpu_to_core_ratio : 1800 + exp_latency : 1 + +test_ipv6_simple : + multiplier : 18 + cores : 4 + cpu_to_core_ratio : 30070000 + cpu2core_custom_dev: YES + cpu2core_dev : 0.07 + + +test_rx_check_sfr: + multiplier : 15 + cores : 3 + rx_sample_rate : 16 + # allow 0.03% errors, bad router + error_tolerance : 0.03 + +test_rx_check_http: + multiplier : 15000 + cores : 1 + rx_sample_rate : 16 + # allow 0.03% errors, bad router + error_tolerance : 0.03 + +test_rx_check_sfr_ipv6: + multiplier : 15 + cores : 3 + rx_sample_rate : 16 + # allow 0.03% errors, bad router + error_tolerance : 0.03 + +test_rx_check_http_ipv6: + multiplier : 15000 + cores : 1 + rx_sample_rate : 16 + # allow 0.03% errors, bad router + error_tolerance : 0.03 + +test_rx_check_http_negative: + multiplier : 13000 + cores : 1 + rx_sample_rate : 16 + stat_route_dict : + clients_start : 16.0.0.1 + servers_start : 48.0.0.1 + dual_port_mask : 1.0.0.0 + client_destination_mask : 255.0.0.0 + server_destination_mask : 255.0.0.0 + nat_dict : + clients_net_start : 16.0.0.0 + client_acl_wildcard_mask : 0.0.0.255 + dual_port_mask : 1.0.0.0 + pool_start : 200.0.0.0 + pool_netmask : 255.255.255.0 diff --git a/scripts/automation/regression/setups/trex12/config.yaml b/scripts/automation/regression/setups/trex12/config.yaml new file mode 100644 index 00000000..af17db45 --- /dev/null +++ b/scripts/automation/regression/setups/trex12/config.yaml @@ -0,0 +1,68 @@ +################################################################ +#### T-Rex nightly test configuration file #### +################################################################ + + +### T-Rex configuration: +# hostname - can be DNS name or IP for the TRex machine for ssh to the box +# password - root password for TRex machine +# is_dual - should the TRex inject with -p ? +# version_path - path to the t-rex version and executable +# cores - how many cores should be used +# latency - rate of latency packets injected by the TRex +# modes - list of modes (tagging) of this setup (loopback etc.) +# * loopback - Trex works via loopback. Router and TFTP configurations may be skipped. +# * VM - Virtual OS (accept low CPU utilization in tests, latency can get spikes) +# * virt_nics - NICs are virtual (VMXNET3 etc.) + +### Router configuration: +# hostname - the router hostname as apears in ______# cli prefix +# ip_address - the router's ip that can be used to communicate with +# image - the desired imaged wished to be loaded as the router's running config +# line_password - router password when access via Telent +# en_password - router password when changing to "enable" mode +# interfaces - an array of client-server pairs, representing the interfaces configurations of the router +# configurations - an array of configurations that could possibly loaded into the router during the test. +# The "clean" configuration is a mandatory configuration the router will load with to run the basic test bench + +### TFTP configuration: +# hostname - the tftp hostname +# ip_address - the tftp's ip address +# images_path - the tftp's relative path in which the router's images are located + +### Test_misc configuration: +# expected_bw - the "golden" bandwidth (in Gbps) results planned on receiving from the test + +trex: + hostname : csi-trex-12 +# version_path : /auto/proj-pcube-b/apps/PL-b/tools/bp_sim2/v1.57/ #/auto/srg-sce-swinfra-usr/emb/users/danklei/Work/asr1k/emb/private/bpsim/main/scripts + cores : 1 + modes : [VM] + +router: + model : ASR1001x + hostname : csi-asr-01 + ip_address : 10.56.216.103 + image : asr1001x-universalk9_npe.BLD_V155_2_S_XE315_THROTTLE_LATEST_20151121_110441-std_2.SSA.bin + line_password : cisco + en_password : cisco + mgmt_interface : GigabitEthernet0 + clean_config : /Configurations/danklei/asr1001_TRex_clean_config.cfg + intf_masking : 255.255.255.0 + ipv6_mask : 64 + interfaces : + - client : + name : Te0/0/0 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + server : + name : Te0/0/1 + src_mac_addr : 0000.0001.0000 + dest_mac_addr : 0000.0001.0000 + vrf_name : null + +tftp: + hostname : ats-asr-srv-1 + ip_address : 10.56.128.23 + root_dir : /auto/avc-devtest/ + images_path : /images/RP2/ diff --git a/scripts/automation/regression/style.css b/scripts/automation/regression/style.css deleted file mode 100755 index b5996af1..00000000 --- a/scripts/automation/regression/style.css +++ /dev/null @@ -1,54 +0,0 @@ -html {overflow-y:scroll;} - -body { - font-size:12px; - color:#000000; - background-color:#ffffff; - margin:0px; - font-family:verdana,helvetica,arial,sans-serif; -} - -div {width:100%;} - -table,th,td,input,textarea { - font-size:100%; -} - -table.reference, table.reference_fail { - background-color:#ffffff; - border:1px solid #c3c3c3; - border-collapse:collapse; - vertical-align:middle; -} - -table.reference th { - background-color:#e5eecc; - border:1px solid #c3c3c3; - padding:3px; -} - -table.reference_fail th { - background-color:#ffcccc; - border:1px solid #c3c3c3; - padding:3px; -} - - -table.reference td, table.reference_fail td { - border:1px solid #c3c3c3; - padding:3px; -} - -a.example {font-weight:bold} - -#a:link,a:visited {color:#900B09; background-color:transparent} -#a:hover,a:active {color:#FF0000; background-color:transparent} - -.linktr { - cursor: pointer; -} - -.linktext { - color:#0000FF; - text-decoration: underline; -}
\ No newline at end of file diff --git a/scripts/automation/regression/trex_unit_test.py b/scripts/automation/regression/trex_unit_test.py index 9e3652b4..f38eb04e 100755 --- a/scripts/automation/regression/trex_unit_test.py +++ b/scripts/automation/regression/trex_unit_test.py @@ -199,10 +199,10 @@ if __name__ == "__main__": long_test = False xml_name = 'unit_test.xml' CTRexScenario.report_dir = 'reports' - setup_dir = os.getenv('SETUP_DIR', '')#.rstrip('/') + setup_dir = os.getenv('SETUP_DIR', '').rstrip('/') CTRexScenario.setup_dir = check_setup_path(setup_dir) if not CTRexScenario.setup_dir: - CTRexScenario.setup_dir = check_setup_path(os.path.join(os.pardir, os.pardir, os.pardir, os.pardir, 'trex-local', 'setups', setup_dir)) + CTRexScenario.setup_dir = check_setup_path(os.path.join('setups', setup_dir)) if CTRexScenario.setup_dir: CTRexScenario.setup_name = os.path.basename(CTRexScenario.setup_dir) diff --git a/scripts/automation/trex_control_plane/client/trex_stateless_sim.py b/scripts/automation/trex_control_plane/client/trex_stateless_sim.py index 5d06c6e5..d38411a3 100644 --- a/scripts/automation/trex_control_plane/client/trex_stateless_sim.py +++ b/scripts/automation/trex_control_plane/client/trex_stateless_sim.py @@ -26,6 +26,8 @@ except ImportError: from client_utils.jsonrpc_client import JsonRpcClient, BatchMessage from client_utils.packet_builder import CTRexPktBuilder +from client_utils import parsing_opts + import json from common.trex_streams import * @@ -37,6 +39,8 @@ import os from dpkt import pcap from operator import itemgetter +class BpSimException(Exception): + pass def merge_cap_files (pcap_file_list, out_filename, delete_src = False): @@ -68,29 +72,21 @@ def merge_cap_files (pcap_file_list, out_filename, delete_src = False): class SimRun(object): - def __init__ (self, yaml_file, dp_core_count, core_index, packet_limit, output_filename, is_valgrind, is_gdb, limit): + def __init__ (self, options): - self.yaml_file = yaml_file - self.output_filename = output_filename - self.dp_core_count = dp_core_count - self.core_index = core_index - self.packet_limit = packet_limit - self.is_valgrind = is_valgrind - self.is_gdb = is_gdb - self.limit = limit + self.options = options # dummies self.handler = 0 self.port_id = 0 - self.mul = {"op": "abs", - "type": "raw", - "value": 1} + + self.mul = options.mult self.duration = -1 def load_yaml_file (self): streams_db = CStreamsDB() - stream_list = streams_db.load_yaml_file(self.yaml_file) + stream_list = streams_db.load_yaml_file(self.options.input_file) streams_json = [] for stream in stream_list.compiled: @@ -130,44 +126,70 @@ class SimRun(object): f.close() try: - cmd = ['bp-sim-64-debug', - '--pcap', - '--sl', - '--cores', - str(self.dp_core_count), - '--limit', - str(self.limit), - '-f', - f.name, - '-o', - self.output_filename] - - if self.core_index != None: - cmd += ['--core_index', str(self.core_index)] - - if self.is_valgrind: - cmd = ['valgrind', '--leak-check=full'] + cmd - elif self.is_gdb: - cmd = ['gdb', '--args'] + cmd - - print "executing command: '{0}'".format(" ".join(cmd)) - subprocess.call(cmd) - - # core index - if (self.dp_core_count > 1) and (self.core_index == None): - self.merge_results() - + if self.options.json: + with open(f.name) as file: + data = "\n".join(file.readlines()) + print json.dumps(json.loads(data), indent = 4, separators=(',', ': '), sort_keys = True) + else: + self.execute_bp_sim(f.name) finally: os.unlink(f.name) + + def execute_bp_sim (self, json_filename): + exe = 'bp-sim-64' if self.options.release else 'bp-sim-64-debug' + if not os.path.exists(exe): + print "cannot find executable '{0}'".format(exe) + exit(-1) + + cmd = [exe, + '--pcap', + '--sl', + '--cores', + str(self.options.cores), + '--limit', + str(self.options.limit), + '-f', + json_filename, + '-o', + self.options.output_file] + + if self.options.dry: + cmd += ['--dry'] + + if self.options.core_index != None: + cmd += ['--core_index', str(self.options.core_index)] + + if self.options.valgrind: + cmd = ['valgrind', '--leak-check=full', '--error-exitcode=1'] + cmd + + elif self.options.gdb: + cmd = ['gdb', '--args'] + cmd + + print "executing command: '{0}'".format(" ".join(cmd)) + rc = subprocess.call(cmd) + if rc != 0: + raise BpSimException() + + self.merge_results() + + def merge_results (self): - if (self.core_index != None) or (self.dp_core_count == 1): - # nothing to do + if self.options.dry: + return + + if self.options.cores == 1: return - inputs = ["{0}-{1}".format(self.output_filename, index) for index in xrange(0, self.dp_core_count)] - merge_cap_files(inputs, self.output_filename, delete_src = True) + if self.options.core_index != None: + return + + + print "Mering cores output to a single pcap file...\n" + inputs = ["{0}-{1}".format(self.options.output_file, index) for index in xrange(0, self.options.cores)] + merge_cap_files(inputs, self.options.output_file, delete_src = True) + @@ -180,8 +202,8 @@ def is_valid_file(filename): def unsigned_int (x): x = int(x) - if x <= 0: - raise argparse.ArgumentTypeError("argument must be >= 1") + if x < 0: + raise argparse.ArgumentTypeError("argument must be >= 0") return x @@ -207,16 +229,26 @@ def setParserOptions(): default = None, type = int) - parser.add_argument("-j", "--join", - help = "run and join output from 0..core_count [default is False]", - default = False, - type = bool) + parser.add_argument("-r", "--release", + help = "runs on release image instead of debug [default is False]", + action = "store_true", + default = False) + + parser.add_argument("-s", "--dry", + help = "dry run only (nothing will be written to the file) [default is False]", + action = "store_true", + default = False) parser.add_argument("-l", "--limit", help = "limit test total packet count [default is 5000]", default = 5000, type = unsigned_int) + parser.add_argument('-m', '--multiplier', + help = parsing_opts.match_multiplier_help, + dest = 'mult', + default = {'type':'raw', 'value':1, 'op': 'abs'}, + type = parsing_opts.match_multiplier_strict) group = parser.add_mutually_exclusive_group() @@ -230,6 +262,11 @@ def setParserOptions(): action = "store_true", default = False) + group.add_argument("--json", + help = "generate JSON output only to stdout [default is False]", + action = "store_true", + default = False) + return parser @@ -239,6 +276,9 @@ def validate_args (parser, options): if not options.core_index in xrange(0, options.cores): parser.error("DP core index valid range is 0 to {0}".format(options.cores - 1)) + # zero is ok - no limit, but other values must be at least as the number of cores + if (options.limit != 0) and options.limit < options.cores: + parser.error("limit cannot be lower than number of DP cores") def main (): @@ -247,17 +287,19 @@ def main (): validate_args(parser, options) - r = SimRun(options.input_file, - options.cores, - options.core_index, - options.limit, - options.output_file, - options.valgrind, - options.gdb, - options.limit) + r = SimRun(options) + + try: + r.run() + except KeyboardInterrupt as e: + print "\n\n*** Caught Ctrl + C... Exiting...\n\n" + exit(1) - r.run() + except BpSimException as e: + print "\n\n*** BP sim exit code was non zero\n\n" + exit(1) + exit(0) if __name__ == '__main__': main() diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp index fcef049c..31ce0440 100755 --- a/src/bp_sim.cpp +++ b/src/bp_sim.cpp @@ -3180,10 +3180,12 @@ int CNodeGenerator::close_file(CFlowGenListPerThread * thread){ int CNodeGenerator::update_stl_stats(CGenNodeStateless *node_sl){ m_cnt++; + #ifdef _DEBUG if ( m_preview_mode.getVMode() >2 ){ fprintf(stdout," %4lu ,", (ulong)m_cnt); node_sl->Dump(stdout); } + #endif return (0); } @@ -3537,9 +3539,6 @@ int CNodeGenerator::flush_file(dsec_t max_time, } } - //#ifndef RTE_DPDK - //thread->check_msgs(); - //#endif uint8_t type=node->m_type; @@ -3553,7 +3552,7 @@ int CNodeGenerator::flush_file(dsec_t max_time, } else { node_sl->handle(thread); - #ifdef _DEBUG + #ifdef TREX_SIM update_stl_stats(node_sl); if (has_limit_reached()) { thread->m_stateless_dp_info.stop_traffic(node_sl->get_port_id(), false, 0); @@ -4706,13 +4705,11 @@ int CErfIFStl::send_node(CGenNode * _no_to_use){ rte_pktmbuf_free(m); } - - BP_ASSERT(m_writer); - bool res=m_writer->write_packet(m_raw); - - - BP_ASSERT(res); + + int rc = write_pkt(m_raw); + BP_ASSERT(rc == 0); } + return (0); } @@ -4750,13 +4747,9 @@ int CErfIF::send_node(CGenNode * node){ //utl_DumpBuffer(stdout,p, 12,0); - BP_ASSERT(m_writer); - - bool res=m_writer->write_packet(m_raw); - - //utl_DumpBuffer(stdout,m_raw->raw,m_raw->pkt_len,0); + int rc = write_pkt(m_raw); + BP_ASSERT(rc == 0); - BP_ASSERT(res); rte_pktmbuf_free(m); } return (0); diff --git a/src/bp_sim.h b/src/bp_sim.h index 4b906912..b9a42027 100755 --- a/src/bp_sim.h +++ b/src/bp_sim.h @@ -776,6 +776,7 @@ public: uint16_t m_run_flags; uint8_t m_mac_splitter; uint8_t m_l_pkt_mode; + uint16_t m_debug_pkt_proto; trex_run_mode_e m_run_mode; @@ -1835,7 +1836,7 @@ public: protected: - void fill_raw_packet(rte_mbuf_t * m,CGenNode * node,pkt_dir_t dir); + virtual void fill_raw_packet(rte_mbuf_t * m,CGenNode * node,pkt_dir_t dir); CFileWriterBase * m_writer; CCapPktRaw * m_raw; @@ -1849,6 +1850,41 @@ public: virtual int send_node(CGenNode * node); }; +/** + * same as regular STL but no I/O (dry run) + * + * @author imarom (07-Jan-16) + */ +class CErfIFStlNull : public CErfIFStl { +public: + + virtual int open_file(std::string file_name) { + return (0); + } + + virtual int write_pkt(CCapPktRaw *pkt_raw) { + return (0); + } + + virtual int close_file(void) { + return (0); + } + + virtual void fill_raw_packet(rte_mbuf_t * m,CGenNode * node,pkt_dir_t dir) { + + } + + virtual int update_mac_addr_from_global_cfg(pkt_dir_t dir, uint8_t * p){ + return (0); + } + + + virtual int flush_tx_queue(void){ + return (0); + + } + +}; static inline int fill_pkt(CCapPktRaw * raw,rte_mbuf_t * m){ diff --git a/src/debug.cpp b/src/debug.cpp new file mode 100644 index 00000000..e5e207e1 --- /dev/null +++ b/src/debug.cpp @@ -0,0 +1,330 @@ +/* + Copyright (c) 2016-2016 Cisco Systems, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +// DPDK c++ issue +#define UINT8_MAX 255 +#define UINT16_MAX 0xFFFF +// DPDK c++ issue + +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <assert.h> +#include <rte_mbuf.h> +#include <rte_pci.h> +#include <rte_ethdev.h> +#include <common/basic_utils.h> +#include "main_dpdk.h" +#include "debug.h" + +const uint8_t udp_pkt[] = { + 0x00,0x00,0x00,0x01,0x00,0x00, + 0x00,0x00,0x00,0x01,0x00,0x00, + 0x08,0x00, + + 0x45,0x00,0x00,0x81, + 0xaf,0x7e,0x00,0x00, + 0xfe,0x06,0xd9,0x23, + 0x01,0x01,0x01,0x01, + 0x3d,0xad,0x72,0x1b, + + 0x11,0x11, + 0x11,0x11, + 0x00,0x6d, + 0x00,0x00, + + 0x64,0x31,0x3a,0x61, + 0x64,0x32,0x3a,0x69,0x64, + 0x32,0x30,0x3a,0xd0,0x0e, + 0xa1,0x4b,0x7b,0xbd,0xbd, + 0x16,0xc6,0xdb,0xc4,0xbb,0x43, + 0xf9,0x4b,0x51,0x68,0x33,0x72, + 0x20,0x39,0x3a,0x69,0x6e,0x66,0x6f, + 0x5f,0x68,0x61,0x73,0x68,0x32,0x30,0x3a,0xee,0xc6,0xa3, + 0xd3,0x13,0xa8,0x43,0x06,0x03,0xd8,0x9e,0x3f,0x67,0x6f, + 0xe7,0x0a,0xfd,0x18,0x13,0x8d,0x65,0x31,0x3a,0x71,0x39, + 0x3a,0x67,0x65,0x74,0x5f,0x70,0x65,0x65,0x72,0x73,0x31, + 0x3a,0x74,0x38,0x3a,0x3d,0xeb,0x0c,0xbf,0x0d,0x6a,0x0d, + 0xa5,0x31,0x3a,0x79,0x31,0x3a,0x71,0x65,0x87,0xa6,0x7d, + 0xe7 +}; + +CTrexDebug::CTrexDebug(CPhyEthIF m_ports_arg[12], int max_ports) { + m_test = NULL; + m_ports = m_ports_arg; + m_max_ports = max_ports; +} + +int CTrexDebug::rcv_send(int port, int queue_id) { + CPhyEthIF * lp = &m_ports[port]; + rte_mbuf_t * rx_pkts[32]; + printf(" test rx port:%d queue:%d \n",port,queue_id); + printf(" --------------\n"); + uint16_t cnt = lp->rx_burst(queue_id,rx_pkts,32); + int i; + + for (i=0; i < (int)cnt; i++) { + rte_mbuf_t * m = rx_pkts[i]; + int pkt_size = rte_pktmbuf_pkt_len(m); + char *p = rte_pktmbuf_mtod(m, char*); + utl_DumpBuffer(stdout, p, pkt_size, 0); + rte_pktmbuf_free(m); + } + return 0; +} + +int CTrexDebug::rcv_send_all(int queue_id) { + int i; + for (i=0; i<m_max_ports; i++) { + rcv_send(i,queue_id); + } + return 0; +} + +// For playing around, and testing packet sending in debug mode +rte_mbuf_t *CTrexDebug::create_test_pkt(int pkt_type) { + uint8_t proto; + int pkt_size = 0; + // uint8_t dst_mac[6] = {0xd4, 0x8c, 0xb5, 0xc9, 0x54, 0x2b}; + uint8_t dst_mac[6] = {0x79, 0xa2, 0xe6, 0xd5, 0x39, 0x25}; + uint8_t src_mac[6] = {0xa0, 0x36, 0x9f, 0x38, 0xa4, 0x02}; + uint16_t l2_proto = 0x0008; + uint8_t ip_header[] = { + 0x45,0x02,0x00,0x30, + 0x00,0x00,0x40,0x00, + 0xff,0x01,0xbd,0x04, + 0x10,0x0,0x0,0x1, //SIP + 0x30,0x0,0x0,0x1, //DIP + // 0x82, 0x0b, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // IP option. change 45 to 48 (header len) if using it. + }; + uint8_t udp_header[] = {0x11, 0x11, 0x11,0x11, 0x00, 0x6d, 0x00, 0x00}; + uint8_t udp_data[] = {0x64,0x31,0x3a,0x61, + 0x64,0x32,0x3a,0x69,0x64, + 0x32,0x30,0x3a,0xd0,0x0e, + 0xa1,0x4b,0x7b,0xbd,0xbd, + 0x16,0xc6,0xdb,0xc4,0xbb,0x43, + 0xf9,0x4b,0x51,0x68,0x33,0x72, + 0x20,0x39,0x3a,0x69,0x6e,0x66,0x6f, + 0x5f,0x68,0x61,0x73,0x68,0x32,0x30,0x3a,0xee,0xc6,0xa3, + 0xd3,0x13,0xa8,0x43,0x06,0x03,0xd8,0x9e,0x3f,0x67,0x6f, + 0xe7,0x0a,0xfd,0x18,0x13,0x8d,0x65,0x31,0x3a,0x71,0x39, + 0x3a,0x67,0x65,0x74,0x5f,0x70,0x65,0x65,0x72,0x73,0x31, + 0x3a,0x74,0x38,0x3a,0x3d,0xeb,0x0c,0xbf,0x0d,0x6a,0x0d, + 0xa5,0x31,0x3a,0x79,0x31,0x3a,0x71,0x65,0x87,0xa6,0x7d, + 0xe7 + }; + uint8_t tcp_header[] = {0xab, 0xcd, 0x00, 0x80, // src, dst ports + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // seq num, ack num + 0x50, 0x00, 0xff, 0xff, // Header size, flags, window size + 0x00, 0x00, 0x00, 0x00, // checksum ,urgent pointer + }; + + uint8_t tcp_data[] = {0x8, 0xa, 0x1, 0x2, 0x3, 0x4, 0x3, 0x4, 0x6, 0x5}; + + uint8_t icmp_header[] = { + 0x08, 0x00, + 0xb8, 0x21, //checksum + 0xaa, 0xbb, // id + 0x00, 0x01, // Sequence number + }; + uint8_t icmp_data[] = { + 0xd6, 0x6e, 0x64, 0x34, // magic + 0x6a, 0xad, 0x0f, 0x00, //64 bit counter + 0x00, 0x56, 0x34, 0x12, + 0x78, 0x56, 0x34, 0x12, 0x00, 0x00 // seq + }; + + switch (pkt_type) { + case 1: + proto = IPPROTO_ICMP; + pkt_size = 14 + sizeof(ip_header) + sizeof(icmp_header) + sizeof (icmp_data); + break; + case 2: + proto = IPPROTO_UDP; + pkt_size = 14 + sizeof(ip_header) + sizeof(udp_header) + sizeof (udp_data); + break; + case 3: + proto = IPPROTO_TCP; + pkt_size = 14 + sizeof(ip_header) + sizeof(tcp_header) + sizeof (tcp_data); + break; + default: + return NULL; + } + + rte_mbuf_t *m = CGlobalInfo::pktmbuf_alloc(0, pkt_size); + if ( unlikely(m == 0) ) { + printf("ERROR no packets \n"); + return (NULL); + } + char *p = rte_pktmbuf_append(m, pkt_size); + assert(p); + + /* set pkt data */ + memcpy(p, dst_mac, sizeof(dst_mac)); p += sizeof(dst_mac); + memcpy(p, src_mac, sizeof(src_mac)); p += sizeof(src_mac); + memcpy(p, &l2_proto, sizeof(l2_proto)); p += sizeof(l2_proto); + struct IPHeader *ip = (IPHeader *)p; + memcpy(p, ip_header, sizeof(ip_header)); p += sizeof(ip_header); + ip->setProtocol(proto); + ip->setTotalLength(pkt_size - 14); + + struct TCPHeader *tcp = (TCPHeader *)p; + struct ICMPHeader *icmp= (ICMPHeader *)p; + switch (pkt_type) { + case 1: + memcpy(p, icmp_header, sizeof(icmp_header)); p += sizeof(icmp_header); + memcpy(p, icmp_data, sizeof(icmp_data)); p += sizeof(icmp_data); + icmp->updateCheckSum(sizeof(icmp_header) + sizeof(icmp_data)); + break; + case 2: + memcpy(p, udp_header, sizeof(udp_header)); p += sizeof(udp_header); + memcpy(p, udp_data, sizeof(udp_data)); p += sizeof(udp_data); + break; + case 3: + memcpy(p, tcp_header, sizeof(tcp_header)); p += sizeof(tcp_header); + memcpy(p, tcp_data, sizeof(tcp_data)); p += sizeof(tcp_data); + tcp->setSynFlag(true); + printf("Sending TCP header:"); + tcp->dump(stdout); + break; + default: + return NULL; + } + + ip->updateCheckSum(); + return m; +} + +rte_mbuf_t *CTrexDebug::create_pkt(uint8_t *pkt, int pkt_size) { + rte_mbuf_t *m = CGlobalInfo::pktmbuf_alloc(0, pkt_size); + if ( unlikely(m == 0) ) { + printf("ERROR no packets \n"); + return 0; + } + + char *p = rte_pktmbuf_append(m, pkt_size); + assert(p); + /* set pkt data */ + memcpy(p, pkt, pkt_size); + return m; +} + +rte_mbuf_t *CTrexDebug::create_pkt_indirect(rte_mbuf_t *m, uint32_t new_pkt_size){ + rte_mbuf_t *d = CGlobalInfo::pktmbuf_alloc(0, 60); + assert(d); + + rte_pktmbuf_attach(d, m); + d->data_len = new_pkt_size; + d->pkt_len = new_pkt_size; + return d; +} + +rte_mbuf_t *CTrexDebug::create_udp_9k_pkt() { + rte_mbuf_t *m; + uint16_t pkt_size = 9*1024+21; + uint8_t *p = (uint8_t *)malloc(9*1024+22); + assert(p); + memset(p, 0x55, pkt_size); + memcpy(p, (uint8_t*)udp_pkt, sizeof(udp_pkt)); + m = create_pkt(p, pkt_size); + free(p); + return m; +} + +int CTrexDebug::test_send_pkts(rte_mbuf_t *m, uint16_t queue_id, int num_pkts, int port) { + CPhyEthIF * lp = &m_ports[port]; + rte_mbuf_t * tx_pkts[32]; + if (num_pkts > 32) { + num_pkts = 32; + } + + int i; + for (i=0; i < num_pkts; i++) { + rte_mbuf_refcnt_update(m, 1); + tx_pkts[i] = m; + } + uint16_t res = lp->tx_burst(queue_id, tx_pkts, num_pkts); + if ((num_pkts - res) > 0) { + m_test_drop += (num_pkts - res); + } + return (0); +} + +int CTrexDebug::set_promisc_all(bool enable) { + int i; + for (i=0; i < m_max_ports; i++) { + CPhyEthIF *_if = &m_ports[i]; + _if->set_promiscuous(enable); + } + + return 0; +} + +int CTrexDebug::test_send(uint pkt_type) { + set_promisc_all(true); + rte_mbuf_t *m, *d; + if (pkt_type < 1 || pkt_type > 4) { + printf("Unsupported packet type %d\n", pkt_type); + printf("Supported packet types are: %d(ICMP), %d(UDP), %d(TCP) %d(9k UDP)\n", 1, 2, 3, 4); + exit(-1); + } + + if (pkt_type == 4) { + m = create_udp_9k_pkt(); + assert (m); + d = create_pkt_indirect(m, 9*1024+18); + } else { + d = create_test_pkt(pkt_type); + } + if (d == NULL) { + printf("Packet creation failed\n"); + exit(-1); + } + + printf("Sending packet:\n"); + utl_DumpBuffer(stdout, rte_pktmbuf_mtod(d, char *), 64, 0); + + test_send_pkts(d, 0, 2, 0); + test_send_pkts(d, 0, 1, 1); + + delay(1000); + + printf(" ---------\n"); + printf(" rx queue 0 \n"); + printf(" ---------\n"); + rcv_send_all(0); + printf("\n\n"); + + printf(" ---------\n"); + printf(" rx queue 1 \n"); + printf(" ---------\n"); + rcv_send_all(1); + printf(" ---------\n"); + + delay(1000); + + int j=0; + for (j=0; j<m_max_ports; j++) { + CPhyEthIF * lp=&m_ports[j]; + printf(" port : %d \n",j); + printf(" ----------\n"); + lp->update_counters(); + lp->get_stats().Dump(stdout); + lp->dump_stats_extended(stdout); + } + + return (0); +} diff --git a/src/debug.h b/src/debug.h new file mode 100644 index 00000000..fe37c186 --- /dev/null +++ b/src/debug.h @@ -0,0 +1,42 @@ +/* +Copyright (c) 2016-2016 Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#ifndef _TREX_DEBUG_H +#define _TREX_DEBUG_H +#include "mbuf.h" + +class CTrexDebug { + rte_mbuf_t *m_test; + uint64_t m_test_drop; + CPhyEthIF *m_ports; + uint32_t m_max_ports; + + int rcv_send(int port,int queue_id); + int rcv_send_all(int queue_id); + rte_mbuf_t *create_pkt(uint8_t *pkt,int pkt_size); + rte_mbuf_t *create_pkt_indirect(rte_mbuf_t *m, uint32_t new_pkt_size); + rte_mbuf_t *create_udp_pkt(); + rte_mbuf_t *create_udp_9k_pkt(); + int set_promisc_all(bool enable); + int test_send_pkts(rte_mbuf_t *, uint16_t queue_id, int pkt, int port); + rte_mbuf_t *create_test_pkt(int proto); + + public: + CTrexDebug(CPhyEthIF *m_ports_arg, int max_ports); + int test_send(uint pkt_type); +}; + +#endif diff --git a/src/main.cpp b/src/main.cpp index ea8e1e44..a2d06067 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,7 +36,8 @@ using namespace std; // An enum for all the option types enum { OPT_HELP, OPT_CFG, OPT_NODE_DUMP, OP_STATS, OPT_FILE_OUT, OPT_UT, OPT_PCAP, OPT_IPV6, OPT_MAC_FILE, - OPT_SL, OPT_DP_CORE_COUNT, OPT_DP_CORE_INDEX, OPT_LIMIT}; + OPT_SL, OPT_DP_CORE_COUNT, OPT_DP_CORE_INDEX, OPT_LIMIT, + OPT_DRY_RUN}; @@ -75,16 +76,12 @@ static CSimpleOpt::SOption parser_options[] = { OPT_DP_CORE_COUNT, "--cores", SO_REQ_SEP }, { OPT_DP_CORE_INDEX, "--core_index", SO_REQ_SEP }, { OPT_LIMIT, "--limit", SO_REQ_SEP }, + { OPT_DRY_RUN, "--dry", SO_NONE }, SO_END_OF_OPTIONS }; - -static bool in_range(int x, int low, int high) { - return ( (x >= low) && (x <= high) ); -} - static int usage(){ printf(" Usage: bp_sim [OPTION] -f cfg.yaml -o outfile.erf \n"); @@ -189,6 +186,10 @@ static int parse_options(int argc, params["limit"] = atoi(args.OptionArg()); break; + case OPT_DRY_RUN: + params["dry"] = 1; + break; + default: usage(); return -1; @@ -277,12 +278,18 @@ int main(int argc , char * argv[]){ params["limit"] = 5000; } + if (params.count("dry") == 0) { + params["dry"] = 0; + } + return st.run(CGlobalInfo::m_options.cfg_file, CGlobalInfo::m_options.out_file, 2, params["dp_core_count"], params["dp_core_index"], - params["limit"]); + params["limit"], + (params["dry"] == 1) + ); } } } diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index 3b332d5a..d3dcb0c5 100755 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -4,7 +4,7 @@ */ /* -Copyright (c) 2015-2015 Cisco Systems, Inc. +Copyright (c) 2015-2016 Cisco Systems, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -79,6 +79,8 @@ extern "C" { #include "msg_manager.h" #include "platform_cfg.h" #include "latency.h" +#include "main_dpdk.h" +#include "debug.h" #include <internal_api/trex_platform_api.h> @@ -119,8 +121,8 @@ static inline int get_is_latency_thread_enable(){ } struct port_cfg_t; -class CPhyEthIF; -class CPhyEthIFStats ; +//class CPhyEthIF; +//class CPhyEthIFStats ; class CTRexExtendedDriverBase { public: @@ -502,8 +504,8 @@ enum { OPT_HELP, OPT_VLAN, OPT_VIRT_ONE_TX_RX_QUEUE, OPT_PREFIX, - OPT_MAC_SPLIT - + OPT_MAC_SPLIT, + OPT_SEND_DEBUG_PKT }; @@ -562,6 +564,7 @@ static CSimpleOpt::SOption parser_options[] = { OPT_VIRT_ONE_TX_RX_QUEUE, "--vm-sim", SO_NONE }, { OPT_PREFIX, "--prefix", SO_REQ_SEP }, { OPT_MAC_SPLIT, "--mac-spread", SO_REQ_SEP }, + { OPT_SEND_DEBUG_PKT, "--send-debug-pkt", SO_REQ_SEP }, SO_END_OF_OPTIONS }; @@ -615,6 +618,9 @@ static int usage(){ printf(" -m : factor of bandwidth \n"); printf(" \n"); + printf(" --send-debug-pkt [proto] : Do not run traffic generator. Just send debug packet and dump receive queue."); + printf(" Supported protocols are 1 for icmp, 2 for UDP, 3 for TCP, 4 for 9K UDP\n"); + printf(" \n"); printf(" -k [sec] : run latency test before starting the test. it will wait for x sec sending packet and x sec after that \n"); printf(" \n"); @@ -897,6 +903,12 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t po->preview.setDestMacSplit(true); break; + case OPT_SEND_DEBUG_PKT: + sscanf(args.OptionArg(),"%d", &tmp_data); + po->m_debug_pkt_proto = (uint8_t)tmp_data; + break; + + default: usage(); return -1; @@ -1132,31 +1144,6 @@ typedef struct cnt_name_ { #define MY_REG(a) {a,(char *)#a} - -class CPhyEthIFStats { - -public: - uint64_t ipackets; /**< Total number of successfully received packets. */ - uint64_t ibytes; /**< Total number of successfully received bytes. */ - - uint64_t f_ipackets; /**< Total number of successfully received packets - filter SCTP*/ - uint64_t f_ibytes; /**< Total number of successfully received bytes. - filter SCTP */ - - uint64_t opackets; /**< Total number of successfully transmitted packets.*/ - uint64_t obytes; /**< Total number of successfully transmitted bytes. */ - - uint64_t ierrors; /**< Total number of erroneous received packets. */ - uint64_t oerrors; /**< Total number of failed transmitted packets. */ - uint64_t imcasts; /**< Total number of multicast received packets. */ - uint64_t rx_nombuf; /**< Total number of RX mbuf allocation failures. */ - - -public: - void Clear(); - void Dump(FILE *fd); - void DumpAll(FILE *fd); -}; - void CPhyEthIFStats::Clear(){ ipackets =0; @@ -1205,165 +1192,6 @@ void CPhyEthIFStats::Dump(FILE *fd){ DP_A(rx_nombuf); } - - -class CPhyEthIF { -public: - CPhyEthIF (){ - m_port_id=0; - m_rx_queue=0; - } - bool Create(uint8_t portid){ - m_port_id = portid; - m_last_rx_rate = 0.0; - m_last_tx_rate = 0.0; - m_last_tx_pps = 0.0; - return (true); - } - void Delete(); - - void set_rx_queue(uint8_t rx_queue){ - m_rx_queue=rx_queue; - } - - - void configure(uint16_t nb_rx_queue, - uint16_t nb_tx_queue, - const struct rte_eth_conf *eth_conf); - - void macaddr_get(struct ether_addr *mac_addr); - - void get_stats(CPhyEthIFStats *stats); - - void get_stats_1g(CPhyEthIFStats *stats); - - - void rx_queue_setup(uint16_t rx_queue_id, - uint16_t nb_rx_desc, - unsigned int socket_id, - const struct rte_eth_rxconf *rx_conf, - struct rte_mempool *mb_pool); - - void tx_queue_setup(uint16_t tx_queue_id, - uint16_t nb_tx_desc, - unsigned int socket_id, - const struct rte_eth_txconf *tx_conf); - - void configure_rx_drop_queue(); - - void configure_rx_duplicate_rules(); - - void start(); - - void stop(); - - void update_link_status(); - - bool is_link_up(){ - return (m_link.link_status?true:false); - } - - void dump_link(FILE *fd); - - void disable_flow_control(); - - void set_promiscuous(bool enable); - - void add_mac(char * mac); - - - bool get_promiscuous(); - - void dump_stats(FILE *fd); - - void update_counters(); - - - void stats_clear(); - - uint8_t get_port_id(){ - return (m_port_id); - } - - float get_last_tx_rate(){ - return (m_last_tx_rate); - } - - float get_last_rx_rate(){ - return (m_last_rx_rate); - } - - float get_last_tx_pps_rate(){ - return (m_last_tx_pps); - } - - float get_last_rx_pps_rate(){ - return (m_last_rx_pps); - } - - CPhyEthIFStats & get_stats(){ - return ( m_stats ); - } - - void flush_rx_queue(void); - -public: - - inline uint16_t tx_burst(uint16_t queue_id, - struct rte_mbuf **tx_pkts, - uint16_t nb_pkts); - - inline uint16_t rx_burst(uint16_t queue_id, - struct rte_mbuf **rx_pkts, - uint16_t nb_pkts); - - - inline uint32_t pci_reg_read(uint32_t reg_off){ - void *reg_addr; - uint32_t reg_v; - reg_addr = (void *)((char *)m_dev_info.pci_dev->mem_resource[0].addr + - reg_off); - reg_v = *((volatile uint32_t *)reg_addr); - return rte_le_to_cpu_32(reg_v); - } - - - inline void pci_reg_write(uint32_t reg_off, - uint32_t reg_v){ - void *reg_addr; - - reg_addr = (void *)((char *)m_dev_info.pci_dev->mem_resource[0].addr + - reg_off); - *((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v); - } - - void dump_stats_extended(FILE *fd); - - uint8_t get_rte_port_id(void){ - return ( m_port_id ); - } -private: - uint8_t m_port_id; - uint8_t m_rx_queue; - struct rte_eth_link m_link; - uint64_t m_sw_try_tx_pkt; - uint64_t m_sw_tx_drop_pkt; - CBwMeasure m_bw_tx; - CBwMeasure m_bw_rx; - CPPSMeasure m_pps_tx; - CPPSMeasure m_pps_rx; - - CPhyEthIFStats m_stats; - - float m_last_tx_rate; - float m_last_rx_rate; - float m_last_tx_pps; - float m_last_rx_pps; -public: - struct rte_eth_dev_info m_dev_info; -}; - - void CPhyEthIF::flush_rx_queue(void){ rte_mbuf_t * rx_pkts[32]; @@ -1488,8 +1316,8 @@ void CPhyEthIF::configure_rx_duplicate_rules(){ void CPhyEthIF::configure_rx_drop_queue(){ - - if ( get_vm_one_queue_enable() ) { + // In debug mode, we want to see all packets. Don't want to disable any queue. + if ( get_vm_one_queue_enable() || (CGlobalInfo::m_options.m_debug_pkt_proto != 0)) { return; } if ( CGlobalInfo::m_options.is_latency_disabled()==false ) { @@ -1811,25 +1639,6 @@ void CPhyEthIF::stats_clear(){ m_stats.Clear(); } -inline uint16_t CPhyEthIF::tx_burst(uint16_t queue_id, - struct rte_mbuf **tx_pkts, - uint16_t nb_pkts){ - uint16_t ret = rte_eth_tx_burst(m_port_id, queue_id, tx_pkts, nb_pkts); - return (ret); -} - - -inline uint16_t CPhyEthIF::rx_burst(uint16_t queue_id, - struct rte_mbuf **rx_pkts, - uint16_t nb_pkts){ - return (rte_eth_rx_burst(m_port_id, queue_id, - rx_pkts, nb_pkts)); - -} - - - - class CCorePerPort { public: CCorePerPort (){ @@ -2709,13 +2518,7 @@ void CGlobalStats::Dump(FILE *fd,DumpFormat mode){ } - - - - - - -struct CGlobalTRex { +class CGlobalTRex { public: CGlobalTRex (){ @@ -2723,50 +2526,37 @@ public: m_max_cores=1; m_cores_to_dual_ports=0; m_max_queues_per_port=0; - m_test =NULL; m_fl_was_init=false; m_expected_pps=0.0; m_expected_cps=0.0; m_expected_bps=0.0; m_trex_stateless = NULL; } -public: bool Create(); void Delete(); - int ixgbe_prob_init(); int cores_prob_init(); int queues_prob_init(); int ixgbe_start(); int ixgbe_rx_queue_flush(); int ixgbe_configure_mg(); - - bool is_all_links_are_up(bool dump=false); - int set_promisc_all(bool enable); - int reset_counters(); -public: - private: /* try to stop all datapath cores */ void try_stop_all_dp(); /* send message to all dp cores */ int send_message_all_dp(TrexStatelessCpToDpMsgBase *msg); - void check_for_dp_message_from_core(int thread_id); void check_for_dp_messages(); public: - int start_send_master(); int start_master_stateless(); - int run_in_core(virtual_thread_id_t virt_core_id); int stop_core(virtual_thread_id_t virt_core_id); - int core_for_latency(){ if ( (!get_is_latency_thread_enable()) ){ return (-1); @@ -2775,14 +2565,10 @@ public: } } - int run_in_laterncy_core(); - int run_in_master(); int stop_master(); - - - /* return the minimum number of dp cores need to support the active ports + /* return the minimum number of dp cores needed to support the active ports this is for c==1 or m_cores_mul==1 */ int get_base_num_cores(){ @@ -2792,8 +2578,6 @@ public: int get_cores_tx(){ /* 0 - master num_of_cores - - - last for latency */ if ( (!get_is_latency_thread_enable()) ){ return (m_max_cores - 1 ); @@ -2802,77 +2586,27 @@ public: } } - - - -public: - int test_send(); - - - - int rcv_send(int port,int queue_id); - int rcv_send_all(int queue_id); - private: bool is_all_cores_finished(); - int test_send_pkts(uint16_t queue_id, - int pkt, - int port); - - int test_send_one_pkt(rte_mbuf_t *m, - uint16_t queue_id, - int port); - - int create_pkt(uint8_t *pkt,int pkt_size); - rte_mbuf_t * create_pkt_indirect(uint32_t new_pkt_size); - - int create_udp_pkt(); - int create_udp_9k_pkt(); - - - int create_icmp_pkt(); - - - public: void dump_stats(FILE *fd, std::string & json,CGlobalStats::DumpFormat format); - void dump_template_info(std::string & json); - bool sanity_check(); - void update_stats(void); void get_stats(CGlobalStats & stats); - - void dump_post_test_stats(FILE *fd); - void dump_config(FILE *fd); public: port_cfg_t m_port_cfg; - - /* - exaple1 : - req=4 ,m_max_ports =4 ,c=1 , l=1 - - ==> - m_max_cores = 4/2+1+1 =4; - m_cores_mul = 1 - - - */ - uint32_t m_max_ports; /* active number of ports supported options are 2,4,8,10,12 */ uint32_t m_max_cores; /* current number of cores , include master and latency ==> ( master)1+c*(m_max_ports>>1)+1( latency ) */ uint32_t m_cores_mul; /* how cores multipler given c=4 ==> m_cores_mul */ - uint32_t m_max_queues_per_port; uint32_t m_cores_to_dual_ports; /* number of ports that will handle dual ports */ uint16_t m_latency_tx_queue_id; - // statistic CPPSMeasure m_cps; float m_expected_pps; @@ -2880,32 +2614,20 @@ public: float m_expected_bps;//bps float m_last_total_cps; - - CPhyEthIF m_ports[BP_MAX_PORTS]; - CCoreEthIF m_cores_vif_sf[BP_MAX_CORES]; /* counted from 1 , 2,3 core zero is reserve - stateful */ - CCoreEthIFStateless m_cores_vif_sl[BP_MAX_CORES]; /* counted from 1 , 2,3 core zero is reserve - stateless*/ + CCoreEthIF m_cores_vif_sf[BP_MAX_CORES]; /* counted from 1 , 2,3 core zero is reserved - stateful */ + CCoreEthIFStateless m_cores_vif_sl[BP_MAX_CORES]; /* counted from 1 , 2,3 core zero is reserved - stateless*/ CCoreEthIF * m_cores_vif[BP_MAX_CORES]; - - CParserOption m_po ; CFlowGenList m_fl; bool m_fl_was_init; - volatile uint8_t m_signal[BP_MAX_CORES] __rte_cache_aligned ; - CLatencyManager m_mg; CTrexGlobalIoMode m_io_modes; private: - -private: - rte_mbuf_t * m_test; - uint64_t m_test_drop; - CLatencyHWPort m_latency_vports[BP_MAX_PORTS]; /* read hardware driver */ CLatencyVmPort m_latency_vm_vports[BP_MAX_PORTS]; /* vm driver */ - CLatencyPktInfo m_latency_pkt; TrexPublisher m_zmq_publisher; @@ -2913,303 +2635,6 @@ public: TrexStateless *m_trex_stateless; }; - - -int CGlobalTRex::rcv_send(int port,int queue_id){ - - CPhyEthIF * lp=&m_ports[port]; - rte_mbuf_t * rx_pkts[32]; - printf(" test rx port:%d queue:%d \n",port,queue_id); - printf(" --------------\n"); - uint16_t cnt=lp->rx_burst(queue_id,rx_pkts,32); - - int i; - for (i=0; i<(int)cnt;i++) { - rte_mbuf_t * m=rx_pkts[i]; - int pkt_size=rte_pktmbuf_pkt_len(m); - char *p=rte_pktmbuf_mtod(m, char*); - utl_DumpBuffer(stdout,p,pkt_size,0); - rte_pktmbuf_free(m); - } - return (0); -} - -int CGlobalTRex::rcv_send_all(int queue_id){ - int i; - for (i=0; i<m_max_ports; i++) { - rcv_send(i,queue_id); - } - return (0); -} - - - - -int CGlobalTRex::test_send(){ - //int i; - - set_promisc_all(true); - create_udp_9k_pkt(); - assert(m_test); - - rte_mbuf_t * d= create_pkt_indirect(9*1024+18); - test_send_one_pkt(d,0,0); - - - //d= create_pkt_indirect(200); - //test_send_one_pkt(d,0,0); - - printf(" ---------\n"); - printf(" rx queue 0 \n"); - printf(" ---------\n"); - rcv_send_all(0); - printf("\n\n"); - - printf(" ---------\n"); - printf(" rx queue 1 \n"); - printf(" ---------\n"); - rcv_send_all(1); - printf(" ---------\n"); - - delay(1000); - - int j=0; - for (j=0; j<m_max_ports; j++) { - CPhyEthIF * lp=&m_ports[j]; - printf(" port : %d \n",j); - printf(" ----------\n"); - - lp->update_counters(); - lp->get_stats().Dump(stdout); - lp->dump_stats_extended(stdout); - } - - return (0); - -#if 0 - - - for (i=0; i<1; i++) { - //test_send_pkts(0,1,0); - //test_send_pkts(m_latency_tx_queue_id,12,0); - //test_send_pkts(m_latency_tx_queue_id,1,1); - //test_send_pkts(m_latency_tx_queue_id,1,2); - //test_send_pkts(m_latency_tx_queue_id,1,3); - test_send_pkts(0,1,0); - - /*delay(1000); - fprintf(stdout," --------------------------------\n"); - fprintf(stdout," after sending to port %d \n",i); - fprintf(stdout," --------------------------------\n"); - dump_stats(stdout); - fprintf(stdout," --------------------------------\n");*/ - } - //test_send_pkts(m_latency_tx_queue_id,1,1); - //test_send_pkts(m_latency_tx_queue_id,1,2); - //test_send_pkts(m_latency_tx_queue_id,1,3); - - - printf(" ---------\n"); - printf(" rx queue 0 \n"); - printf(" ---------\n"); - rcv_send_all(0); - printf("\n\n"); - - printf(" ---------\n"); - printf(" rx queue 1 \n"); - printf(" ---------\n"); - rcv_send_all(1); - printf(" ---------\n"); - - delay(1000); - - #if 1 - int j=0; - for (j=0; j<m_max_ports; j++) { - CPhyEthIF * lp=&m_ports[j]; - printf(" port : %d \n",j); - printf(" ----------\n"); - - lp->update_counters(); - lp->get_stats().Dump(stdout); - lp->dump_stats_extended(stdout); - } - /*for (j=0; j<4; j++) { - CPhyEthIF * lp=&m_ports[j]; - lp->dump_stats_extended(stdout); - }*/ - #endif - - fprintf(stdout," drop : %llu \n", (unsigned long long)m_test_drop); - - return (0); - #endif -} - - - -const uint8_t udp_pkt[]={ - 0x00,0x00,0x00,0x01,0x00,0x00, - 0x00,0x00,0x00,0x01,0x00,0x00, - 0x08,0x00, - - 0x45,0x00,0x00,0x81, - 0xaf,0x7e,0x00,0x00, - 0xfe,0x06,0xd9,0x23, - 0x01,0x01,0x01,0x01, - 0x3d,0xad,0x72,0x1b, - - 0x11,0x11, - 0x11,0x11, - - 0x00,0x6d, - 0x00,0x00, - - 0x64,0x31,0x3a,0x61, - 0x64,0x32,0x3a,0x69,0x64, - 0x32,0x30,0x3a,0xd0,0x0e, - 0xa1,0x4b,0x7b,0xbd,0xbd, - 0x16,0xc6,0xdb,0xc4,0xbb,0x43, - 0xf9,0x4b,0x51,0x68,0x33,0x72, - 0x20,0x39,0x3a,0x69,0x6e,0x66,0x6f, - 0x5f,0x68,0x61,0x73,0x68,0x32,0x30,0x3a,0xee,0xc6,0xa3, - 0xd3,0x13,0xa8,0x43,0x06,0x03,0xd8,0x9e,0x3f,0x67,0x6f, - 0xe7,0x0a,0xfd,0x18,0x13,0x8d,0x65,0x31,0x3a,0x71,0x39, - 0x3a,0x67,0x65,0x74,0x5f,0x70,0x65,0x65,0x72,0x73,0x31, - 0x3a,0x74,0x38,0x3a,0x3d,0xeb,0x0c,0xbf,0x0d,0x6a,0x0d, - 0xa5,0x31,0x3a,0x79,0x31,0x3a,0x71,0x65,0x87,0xa6,0x7d, - 0xe7 -}; - - -const uint8_t icmp_pkt1[]={ - 0x00,0x00,0x00,0x01,0x00,0x00, - 0x00,0x00,0x00,0x01,0x00,0x00, - 0x08,0x00, - - 0x45,0x02,0x00,0x30, - 0x00,0x00,0x40,0x00, - 0xff,0x01,0xbd,0x04, - 0x9b,0xe6,0x18,0x9b, //SIP - 0xcb,0xff,0xfc,0xc2, //DIP - - 0x08, 0x00, - 0x01, 0x02, //checksum - 0xaa, 0xbb, // id - 0x00, 0x00, // Sequence number - - 0x11,0x22,0x33,0x44, // magic - 0x00,0x00,0x00,0x00, //64 bit counter - 0x00,0x00,0x00,0x00, - 0x00,0x01,0xa0,0x00, //seq - 0x00,0x00,0x00,0x00, - -}; - - - - -int CGlobalTRex::create_pkt(uint8_t *pkt,int pkt_size){ - - rte_mbuf_t * m= CGlobalInfo::pktmbuf_alloc(0,pkt_size); - if ( unlikely(m==0) ) { - printf("ERROR no packets \n"); - return (0); - } - char *p=rte_pktmbuf_append(m, pkt_size); - assert(p); - /* set pkt data */ - memcpy(p,pkt,pkt_size); - m_test = m; - return (0); -} - -rte_mbuf_t * CGlobalTRex::create_pkt_indirect(uint32_t new_pkt_size){ - - rte_mbuf_t * d= CGlobalInfo::pktmbuf_alloc(0,60); - assert(d); - rte_pktmbuf_attach(d,m_test); - d->data_len =new_pkt_size; - d->pkt_len =new_pkt_size; - return (d); -} - -int CGlobalTRex::create_udp_pkt(){ - return (create_pkt((uint8_t*)udp_pkt,sizeof(udp_pkt))); -} - -int CGlobalTRex::create_udp_9k_pkt(){ - uint16_t pkt_size=9*1024+21; - uint8_t *p=(uint8_t *)malloc(9*1024+22); - assert(p); - memset(p,0x55,pkt_size); - memcpy(p,(uint8_t*)udp_pkt,sizeof(udp_pkt)); - create_pkt(p,pkt_size); - free(p); - return (0); -} - - - -int CGlobalTRex::create_icmp_pkt(){ - return (create_pkt((uint8_t*)icmp_pkt1,sizeof(icmp_pkt1))); -} - -int CGlobalTRex::test_send_one_pkt(rte_mbuf_t *m, - uint16_t queue_id, - int port){ - - CPhyEthIF * lp=&m_ports[port]; - rte_mbuf_t * tx_pkts[1]; - tx_pkts[0]=m; - - uint16_t res=lp->tx_burst(queue_id,tx_pkts,1); - if ((1-res)>0) { - m_test_drop+=(1-res); - } - return (0); -} - - -/* test by sending 10 packets ...*/ -int CGlobalTRex::test_send_pkts(uint16_t queue_id, - int pkt, - int port){ - - CPhyEthIF * lp=&m_ports[port]; - rte_mbuf_t * tx_pkts[32]; - if (pkt >32 ) { - pkt =32; - } - - int i; - for (i=0; i<pkt; i++) { - rte_mbuf_refcnt_update(m_test,1); - tx_pkts[i]=m_test; - } - uint16_t res=lp->tx_burst(queue_id,tx_pkts,pkt); - if ((pkt-res)>0) { - m_test_drop+=(pkt-res); - } - return (0); -} - - - - - -int CGlobalTRex::set_promisc_all(bool enable){ - int i; - for (i=0; i<m_max_ports; i++) { - CPhyEthIF * _if=&m_ports[i]; - _if->set_promiscuous(enable); - } - - return (0); -} - - - int CGlobalTRex::reset_counters(){ int i; for (i=0; i<m_max_ports; i++) { @@ -4809,13 +4234,11 @@ int main_test(int argc , char * argv[]){ g_trex.start_send_master(); } - - /* TBD_FDIR */ -#if 0 - printf(" test_send \n"); - g_trex.test_send(); - exit(1); -#endif + if (CGlobalInfo::m_options.m_debug_pkt_proto != 0) { + CTrexDebug debug = CTrexDebug(g_trex.m_ports, g_trex.m_max_ports); + debug.test_send(CGlobalInfo::m_options.m_debug_pkt_proto); + exit(1); + } if ( CGlobalInfo::m_options.preview.getOnlyLatency() ){ rte_eal_mp_remote_launch(latency_one_lcore, NULL, CALL_MASTER); diff --git a/src/main_dpdk.h b/src/main_dpdk.h new file mode 100644 index 00000000..e2c0cdb2 --- /dev/null +++ b/src/main_dpdk.h @@ -0,0 +1,158 @@ +/* +Copyright (c) 2015-2016 Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#ifndef MAIN_DPDK_H +#define MAIN_DPDK_H + +#include "bp_sim.h" + +class CPhyEthIFStats { + +public: + uint64_t ipackets; /**< Total number of successfully received packets. */ + uint64_t ibytes; /**< Total number of successfully received bytes. */ + uint64_t f_ipackets; /**< Total number of successfully received packets - filter SCTP*/ + uint64_t f_ibytes; /**< Total number of successfully received bytes. - filter SCTP */ + uint64_t opackets; /**< Total number of successfully transmitted packets.*/ + uint64_t obytes; /**< Total number of successfully transmitted bytes. */ + uint64_t ierrors; /**< Total number of erroneous received packets. */ + uint64_t oerrors; /**< Total number of failed transmitted packets. */ + uint64_t imcasts; /**< Total number of multicast received packets. */ + uint64_t rx_nombuf; /**< Total number of RX mbuf allocation failures. */ + +public: + void Clear(); + void Dump(FILE *fd); + void DumpAll(FILE *fd); +}; + +class CPhyEthIF { +public: + CPhyEthIF (){ + m_port_id=0; + m_rx_queue=0; + } + bool Create(uint8_t portid){ + m_port_id = portid; + m_last_rx_rate = 0.0; + m_last_tx_rate = 0.0; + m_last_tx_pps = 0.0; + return (true); + } + void Delete(); + + void set_rx_queue(uint8_t rx_queue){ + m_rx_queue=rx_queue; + } + + void configure(uint16_t nb_rx_queue, + uint16_t nb_tx_queue, + const struct rte_eth_conf *eth_conf); + void macaddr_get(struct ether_addr *mac_addr); + void get_stats(CPhyEthIFStats *stats); + void get_stats_1g(CPhyEthIFStats *stats); + void rx_queue_setup(uint16_t rx_queue_id, + uint16_t nb_rx_desc, + unsigned int socket_id, + const struct rte_eth_rxconf *rx_conf, + struct rte_mempool *mb_pool); + void tx_queue_setup(uint16_t tx_queue_id, + uint16_t nb_tx_desc, + unsigned int socket_id, + const struct rte_eth_txconf *tx_conf); + void configure_rx_drop_queue(); + void configure_rx_duplicate_rules(); + void start(); + void stop(); + void update_link_status(); + bool is_link_up(){ + return (m_link.link_status?true:false); + } + void dump_link(FILE *fd); + void disable_flow_control(); + void set_promiscuous(bool enable); + void add_mac(char * mac); + bool get_promiscuous(); + void dump_stats(FILE *fd); + void update_counters(); + void stats_clear(); + uint8_t get_port_id(){ + return (m_port_id); + } + float get_last_tx_rate(){ + return (m_last_tx_rate); + } + float get_last_rx_rate(){ + return (m_last_rx_rate); + } + float get_last_tx_pps_rate(){ + return (m_last_tx_pps); + } + float get_last_rx_pps_rate(){ + return (m_last_rx_pps); + } + CPhyEthIFStats & get_stats(){ + return ( m_stats ); + } + void flush_rx_queue(void); + +public: + inline uint16_t tx_burst(uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + return rte_eth_tx_burst(m_port_id, queue_id, tx_pkts, nb_pkts); + } + inline uint16_t rx_burst(uint16_t queue_id, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { + return rte_eth_rx_burst(m_port_id, queue_id, rx_pkts, nb_pkts); + } + inline uint32_t pci_reg_read(uint32_t reg_off) { + void *reg_addr; + uint32_t reg_v; + reg_addr = (void *)((char *)m_dev_info.pci_dev->mem_resource[0].addr + + reg_off); + reg_v = *((volatile uint32_t *)reg_addr); + return rte_le_to_cpu_32(reg_v); + } + inline void pci_reg_write(uint32_t reg_off, + uint32_t reg_v) { + void *reg_addr; + + reg_addr = (void *)((char *)m_dev_info.pci_dev->mem_resource[0].addr + + reg_off); + *((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v); + } + void dump_stats_extended(FILE *fd); + uint8_t get_rte_port_id(void) { + return m_port_id; + } +private: + uint8_t m_port_id; + uint8_t m_rx_queue; + struct rte_eth_link m_link; + uint64_t m_sw_try_tx_pkt; + uint64_t m_sw_tx_drop_pkt; + CBwMeasure m_bw_tx; + CBwMeasure m_bw_rx; + CPPSMeasure m_pps_tx; + CPPSMeasure m_pps_rx; + CPhyEthIFStats m_stats; + float m_last_tx_rate; + float m_last_rx_rate; + float m_last_tx_pps; + float m_last_rx_pps; +public: + struct rte_eth_dev_info m_dev_info; +}; + +#endif diff --git a/src/pal/linux/mbuf.cpp b/src/pal/linux/mbuf.cpp index 26a54fe9..7e9f4775 100755 --- a/src/pal/linux/mbuf.cpp +++ b/src/pal/linux/mbuf.cpp @@ -89,7 +89,7 @@ void utl_rte_mempool_delete(rte_mempool_t * & pool){ uint16_t rte_mbuf_refcnt_update(rte_mbuf_t *m, int16_t value) { utl_rte_pktmbuf_check(m); - uint32_t a=sanb_atomic_add_return_32_old(&m->refcnt_reserved,1); + uint32_t a=sanb_atomic_add_return_32_old(&m->refcnt_reserved, value); return (a); } @@ -136,11 +136,11 @@ rte_mbuf_t *rte_pktmbuf_alloc(rte_mempool_t *mp){ m->buf_addr =(char *)((char *)m+sizeof(rte_mbuf_t)+RTE_PKTMBUF_HEADROOM) ; rte_pktmbuf_reset(m); + return (m); } - void rte_pktmbuf_free_seg(rte_mbuf_t *m){ utl_rte_pktmbuf_check(m); @@ -150,8 +150,10 @@ void rte_pktmbuf_free_seg(rte_mbuf_t *m){ if ( md != m ) { rte_pktmbuf_detach(m); - if (rte_mbuf_refcnt_update(md, -1) == 0) - free(md); + if (rte_mbuf_refcnt_update(md, -1) == 0) { + free(md); + } + } free(m); diff --git a/src/sim/trex_sim.h b/src/sim/trex_sim.h index a541ce01..8feb7bc0 100644 --- a/src/sim/trex_sim.h +++ b/src/sim/trex_sim.h @@ -32,6 +32,12 @@ class TrexStateless; class TrexPublisher; class DpToCpHandler; + +static inline bool +in_range(int x, int low, int high) { + return ( (x >= low) && (x <= high) ); +} + /** * interface for a sim target * @@ -103,7 +109,8 @@ public: int port_count, int dp_core_count, int dp_core_index, - int limit); + int limit, + bool is_dry_run); TrexStateless * get_stateless_obj() { return m_trex_stateless; @@ -122,12 +129,22 @@ private: void execute_json(const std::string &json_filename); void run_dp(const std::string &out_filename); - uint64_t run_dp_core(int core_index, const std::string &out_filename); + + void run_dp_core(int core_index, + const std::string &out_filename, + uint64_t &simulated_pkts, + uint64_t &written_pkts); void flush_dp_to_cp_messages_core(int core_index); void validate_response(const Json::Value &resp); + bool should_capture_core(int i); + bool is_multiple_capture(); + uint64_t get_limit_per_core(int core_index); + + void show_intro(const std::string &out_filename); + bool is_verbose() { return m_verbose; } @@ -137,12 +154,14 @@ private: TrexPublisher *m_publisher; CFlowGenList m_fl; CErfIFStl m_erf_vif; + CErfIFStlNull m_null_erf_vif; bool m_verbose; int m_port_count; int m_dp_core_count; int m_dp_core_index; uint64_t m_limit; + bool m_is_dry_run; }; #endif /* __TREX_SIM_H__ */ diff --git a/src/sim/trex_sim_stateless.cpp b/src/sim/trex_sim_stateless.cpp index 2b73f686..215315e0 100644 --- a/src/sim/trex_sim_stateless.cpp +++ b/src/sim/trex_sim_stateless.cpp @@ -26,9 +26,34 @@ limitations under the License. #include <json/json.h> #include <stdexcept> #include <sstream> +#include <trex_streams_compiler.h> using namespace std; +/****** utils ******/ +static string format_num(double num, const string &suffix = "") { + const char x[] = {' ','K','M','G','T','P'}; + + double my_num = num; + + for (int i = 0; i < sizeof(x); i++) { + if (std::abs(my_num) < 1000.0) { + stringstream ss; + + char buf[100]; + snprintf(buf, sizeof(buf), "%.2f", my_num); + + ss << buf << " " << x[i] << suffix; + return ss.str(); + + } else { + my_num /= 1000.0; + } + } + + return "NaN"; +} + TrexStateless * get_stateless_obj() { return SimStateless::get_instance().get_stateless_obj(); } @@ -57,8 +82,12 @@ public: virtual void get_global_stats(TrexPlatformGlobalStats &stats) const { } + virtual void get_interface_info(uint8_t interface_id, std::string &driver_name, driver_speed_e &speed) const { + driver_name = "TEST"; + speed = TrexPlatformApi::SPEED_10G; } + virtual void get_interface_stats(uint8_t interface_id, TrexPlatformInterfaceStats &stats) const { } @@ -121,6 +150,7 @@ SimStateless::SimStateless() { m_dp_core_index = -1; m_port_count = -1; m_limit = 0; + m_is_dry_run = false; /* override ownership checks */ TrexRpcCommand::test_set_override_ownership(true); @@ -133,17 +163,19 @@ SimStateless::run(const string &json_filename, int port_count, int dp_core_count, int dp_core_index, - int limit) { + int limit, + bool is_dry_run) { assert(dp_core_count > 0); /* -1 means its not set or positive value between 0 and the dp core count - 1*/ - assert( (dp_core_index == -1) || ( (dp_core_index >=0 ) && (dp_core_index < dp_core_count) ) ); + assert( (dp_core_index == -1) || ( in_range(dp_core_index, 0, dp_core_count - 1)) ); m_dp_core_count = dp_core_count; m_dp_core_index = dp_core_index; m_port_count = port_count; m_limit = limit; + m_is_dry_run = is_dry_run; prepare_dataplane(); prepare_control_plane(); @@ -220,7 +252,11 @@ SimStateless::prepare_dataplane() { m_fl.generate_p_thread_info(m_dp_core_count); for (int i = 0; i < m_dp_core_count; i++) { - m_fl.m_threads_info[i]->set_vif(&m_erf_vif); + if (should_capture_core(i)) { + m_fl.m_threads_info[i]->set_vif(&m_erf_vif); + } else { + m_fl.m_threads_info[i]->set_vif(&m_null_erf_vif); + } } } @@ -267,60 +303,125 @@ SimStateless::validate_response(const Json::Value &resp) { } +static inline bool is_debug() { + #ifdef DEBUG + return true; + #else + return false; + #endif +} void -SimStateless::run_dp(const std::string &out_filename) { - uint64_t pkt_cnt = 0; +SimStateless::show_intro(const std::string &out_filename) { + uint64_t bps = 0; + uint64_t pps = 0; + + std::cout << "\nGeneral info:\n"; + std::cout << "------------\n\n"; - if (m_dp_core_count == 1) { - pkt_cnt = run_dp_core(0, out_filename); + std::cout << "image type: " << (is_debug() ? "debug" : "release") << "\n"; + std::cout << "I/O output: " << (m_is_dry_run ? "*DRY*" : out_filename) << "\n"; + + if (m_limit > 0) { + std::cout << "packet limit: " << m_limit << "\n"; } else { + std::cout << "packet limit: " << "*NO LIMIT*" << "\n"; + } - /* do we have a specific core index to capture ? */ - if (m_dp_core_index != -1) { - for (int i = 0; i < m_dp_core_count; i++) { - if (i == m_dp_core_index) { - pkt_cnt += run_dp_core(i, out_filename); - } else { - run_dp_core(i, "/dev/null"); - } - } - } else { - for (int i = 0; i < m_dp_core_count; i++) { - std::stringstream ss; - ss << out_filename << "-" << i; - pkt_cnt += run_dp_core(i, ss.str()); - } + if (m_dp_core_index != -1) { + std::cout << "core recording: " << m_dp_core_index << "\n"; + } else { + std::cout << "core recording: merge all\n"; + } + + std::cout << "\nConfiguration info:\n"; + std::cout << "-------------------\n\n"; + + std::cout << "ports: " << m_port_count << "\n"; + std::cout << "cores: " << m_dp_core_count << "\n"; + + + std::cout << "\nPort Config:\n"; + std::cout << "------------\n\n"; + + TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(0); + + std::cout << "stream count: " << port->get_stream_count() << "\n"; + + port->get_port_effective_rate(bps, pps); + + std::cout << "max BPS: " << format_num(bps, "bps") << "\n"; + std::cout << "max PPS: " << format_num(pps, "pps") << "\n"; + + std::cout << "\n\nStarting simulation...\n"; +} + +void +SimStateless::run_dp(const std::string &out_filename) { + uint64_t simulated_pkts_cnt = 0; + uint64_t written_pkts_cnt = 0; + + show_intro(out_filename); + + if (is_multiple_capture()) { + for (int i = 0; i < m_dp_core_count; i++) { + std::stringstream ss; + ss << out_filename << "-" << i; + run_dp_core(i, ss.str(), simulated_pkts_cnt, written_pkts_cnt); } + } else { + for (int i = 0; i < m_dp_core_count; i++) { + run_dp_core(i, out_filename, simulated_pkts_cnt, written_pkts_cnt); + } } - - std::cout << "\n"; - std::cout << "ports: " << m_port_count << "\n"; - std::cout << "cores: " << m_dp_core_count << "\n"; + std::cout << "\n\nSimulation summary:\n"; + std::cout << "-------------------\n\n"; + std::cout << "simulated " << simulated_pkts_cnt << " packets\n"; - if (m_dp_core_index != -1) { - std::cout << "core index: " << m_dp_core_index << "\n"; + if (m_is_dry_run) { + std::cout << "*DRY RUN* - no packets were written\n"; } else { - std::cout << "core index: merge all\n"; + std::cout << "written " << written_pkts_cnt << " packets " << "to '" << out_filename << "'\n\n"; } - std::cout << "pkt limit: " << m_limit << "\n"; - std::cout << "\nwritten " << pkt_cnt << " packets " << "to '" << out_filename << "'\n\n"; + std::cout << "\n"; } -uint64_t -SimStateless::run_dp_core(int core_index, const std::string &out_filename) { + +uint64_t +SimStateless::get_limit_per_core(int core_index) { + /* global no limit ? */ + if (m_limit == 0) { + return (0); + } else { + uint64_t l = std::max((uint64_t)1, m_limit / m_dp_core_count); + if (core_index == 0) { + l += (m_limit % m_dp_core_count); + } + return l; + } +} + +void +SimStateless::run_dp_core(int core_index, + const std::string &out_filename, + uint64_t &simulated_pkts, + uint64_t &written_pkts) { CFlowGenListPerThread *lpt = m_fl.m_threads_info[core_index]; - lpt->start_stateless_simulation_file((std::string)out_filename, CGlobalInfo::m_options.preview, m_limit / m_dp_core_count); + lpt->start_stateless_simulation_file((std::string)out_filename, CGlobalInfo::m_options.preview, get_limit_per_core(core_index)); lpt->start_stateless_daemon_simulation(); flush_dp_to_cp_messages_core(core_index); - return lpt->m_node_gen.m_cnt; + simulated_pkts += lpt->m_node_gen.m_cnt; + + if (should_capture_core(core_index)) { + written_pkts += lpt->m_node_gen.m_cnt; + } } @@ -344,3 +445,30 @@ SimStateless::flush_dp_to_cp_messages_core(int core_index) { delete msg; } } + +bool +SimStateless::should_capture_core(int i) { + + /* dry run - no core should be recordered */ + if (m_is_dry_run) { + return false; + } + + /* no specific core index ? record all */ + if (m_dp_core_index == -1) { + return true; + } else { + return (i == m_dp_core_index); + } +} + +bool +SimStateless::is_multiple_capture() { + /* dry run - no core should be recordered */ + if (m_is_dry_run) { + return false; + } + + return ( (m_dp_core_count > 1) && (m_dp_core_index == -1) ); +} + diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp index aa34e87b..05283d5f 100644 --- a/src/stateless/cp/trex_stateless_port.cpp +++ b/src/stateless/cp/trex_stateless_port.cpp @@ -76,6 +76,11 @@ TrexStatelessPort::TrexStatelessPort(uint8_t port_id, const TrexPlatformApi *api m_graph_obj = NULL; } +TrexStatelessPort::~TrexStatelessPort() { + if (m_graph_obj) { + delete m_graph_obj; + } +} /** * acquire the port @@ -589,6 +594,22 @@ TrexStatelessPort::validate(void) { } + +void +TrexStatelessPort::get_port_effective_rate(uint64_t &bps, uint64_t &pps) { + + if (get_stream_count() == 0) { + return; + } + + if (!m_graph_obj) { + generate_streams_graph(); + } + + bps = m_graph_obj->get_max_bps() * m_factor; + pps = m_graph_obj->get_max_pps() * m_factor; +} + /************* Trex Port Owner **************/ TrexPortOwner::TrexPortOwner() { diff --git a/src/stateless/cp/trex_stateless_port.h b/src/stateless/cp/trex_stateless_port.h index a529d38f..c3785b0c 100644 --- a/src/stateless/cp/trex_stateless_port.h +++ b/src/stateless/cp/trex_stateless_port.h @@ -134,6 +134,8 @@ public: TrexStatelessPort(uint8_t port_id, const TrexPlatformApi *api); + ~TrexStatelessPort(); + /** * acquire port * throws TrexException in case of an error @@ -259,6 +261,10 @@ public: return m_stream_table.get_stream_by_id(stream_id); } + int get_stream_count() { + return m_stream_table.size(); + } + void get_id_list(std::vector<uint32_t> &id_list) { m_stream_table.get_id_list(id_list); } @@ -298,6 +304,17 @@ public: return m_owner; } + + /** + * get the port effective rate (on a started / paused port) + * + * @author imarom (07-Jan-16) + * + * @param bps + * @param pps + */ + void get_port_effective_rate(uint64_t &bps, uint64_t &pps); + private: |