This repository has been archived by the owner on Sep 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Crucible1 #169
Draft
atheurer
wants to merge
5
commits into
master
Choose a base branch
from
crucible1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Crucible1 #169
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
base_dir="/opt/trex" | ||
tmp_dir="/tmp" | ||
trex_ver="v2.82" | ||
trex_ver="v2.87" | ||
insecure_curl=0 | ||
force_install=0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,24 @@ def ip_to_int (ip): | |
return ip_int | ||
|
||
|
||
def int_to_ip (_int): | ||
octet = int(_int / (256**3)) | ||
_int = _int - (octet * 256**3) | ||
ip = str(octet) | ||
|
||
octet = int(_int / (256**2)) | ||
_int = _int - (octet * 256**2) | ||
ip = ip + "." + str(octet) | ||
|
||
octet = int(_int / (256**1)) | ||
_int = _int - (octet * 256**1) | ||
ip = ip + "." + str(octet) | ||
|
||
_int = _int - (octet * 256**1) | ||
ip = ip + "." + str(octet) | ||
return ip | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You determined that this is backwards compatible, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||
def calculate_latency_pps (dividend, divisor, total_rate, protocols): | ||
return int((float(dividend) / float(divisor) * total_rate / protocols)) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,8 +85,6 @@ def create_icmp_pkt (size, mac_src, mac_dst, ip_src, ip_dst, vlan_id, flow_mods, | |
pad = max(0, size - len(the_packet)) * 'x' | ||
the_packet = the_packet/pad | ||
|
||
#print("create_icmp_pkt: scapy:%s\n" % (the_packet.command())) | ||
|
||
if tmp_num_flows and (flow_mods['ip']['src'] or flow_mods['ip']['dst'] or flow_mods['mac']['src'] or flow_mods['mac']['dst']): | ||
vm = vm + [STLVmFixIpv4(offset = "IP")] | ||
|
||
|
@@ -145,8 +143,6 @@ def create_garp_pkt (mac_src, ip_src, vlan_id, arp_op, flow_mods, num_flows, ena | |
|
||
the_packet = the_packet/ARP(op = arp_op, hwsrc = mac_src, psrc = str(ip_src['start']), hwdst = arp_mac_target, pdst = str(ip_src['start'])) | ||
|
||
#print("create_garp_pkt: scapy:%s\n" % (the_packet.command())) | ||
|
||
if tmp_num_flows and (flow_mods['ip']['src'] or flow_mods['mac']['src']): | ||
if enable_flow_cache: | ||
vm = STLScVmRaw(list_of_commands = vm, | ||
|
@@ -197,8 +193,8 @@ def create_generic_pkt (size, mac_src, mac_dst, ip_src, ip_dst, port_src, port_d | |
|
||
tmp_num_flows = num_flows - 1 | ||
|
||
ip_src = { "start": ip_to_int(ip_src) + flow_offset, "end": ip_to_int(ip_src) + tmp_num_flows + flow_offset } | ||
ip_dst = { "start": ip_to_int(ip_dst) + flow_offset, "end": ip_to_int(ip_dst) + tmp_num_flows + flow_offset } | ||
ip_src = { "start": int_to_ip(ip_to_int(ip_src) + flow_offset), "end": int_to_ip(ip_to_int(ip_src) + tmp_num_flows + flow_offset) } | ||
ip_dst = { "start": int_to_ip(ip_to_int(ip_dst) + flow_offset), "end": int_to_ip(ip_to_int(ip_dst) + tmp_num_flows + flow_offset) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As noted above, I believe you found this is backwards compatible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||
|
||
vm = [] | ||
if flow_mods['ip']['src'] and tmp_num_flows: | ||
|
@@ -267,7 +263,6 @@ def create_generic_pkt (size, mac_src, mac_dst, ip_src, ip_dst, port_src, port_d | |
pad = max(0, size-len(base)) * 'x' | ||
|
||
the_packet = base/pad | ||
#print("create_generic_pkt: scapy:%s\n" % (the_packet.command())) | ||
|
||
if tmp_num_flows and (flow_mods['ip']['src'] or flow_mods['ip']['dst'] or flow_mods['mac']['src'] or flow_mods['mac']['dst'] or flow_mods['port']['src'] or flow_mods['port']['dst']): | ||
if packet_protocol == "UDP": | ||
|
@@ -296,8 +291,6 @@ def load_user_pkt (the_packet, size, mac_src, mac_dst, ip_src, ip_dst, port_src, | |
while True: | ||
layer = the_packet.getlayer(layer_counter) | ||
if not layer is None: | ||
#print("Layer %d is '%s'" % (layer_counter, layer.name)) | ||
#print(dump_json_readable(layer)) | ||
|
||
if layer.name == "TCP" or layer.name == "UDP": | ||
packet_protocol = layer.name | ||
|
@@ -311,7 +304,6 @@ def load_user_pkt (the_packet, size, mac_src, mac_dst, ip_src, ip_dst, port_src, | |
layer.src = mac_src | ||
layer.dst = mac_dst | ||
|
||
#print(dump_json_readable(layer)) | ||
else: | ||
break | ||
layer_counter += 1 | ||
|
@@ -408,8 +400,6 @@ def load_user_pkt (the_packet, size, mac_src, mac_dst, ip_src, ip_dst, port_src, | |
pad = max(0, size-len(the_packet)) * 'x' | ||
the_packet = the_packet/pad | ||
|
||
#print("load_user_pkt: scapy:%s\n" % (the_packet.command())) | ||
|
||
if tmp_num_flows and (flow_mods['ip']['src'] or flow_mods['ip']['dst'] or flow_mods['mac']['src'] or flow_mods['mac']['dst'] or flow_mods['port']['src'] or flow_mods['port']['dst']): | ||
if packet_protocol == "UDP": | ||
vm = vm + [ STLVmFixChecksumHw(l3_offset = "IP", l4_offset = "UDP", l4_type = CTRexVmInsFixHwCs.L4_TYPE_UDP) ] | ||
|
@@ -502,7 +492,6 @@ def validate_profile_stream(stream, rate_modifier): | |
elif (key == 'the_packet') and (fields[0] == 'scapy'): | ||
try: | ||
stream[key] = eval(fields[1]) | ||
#print("validate_profile_stream:the_packet: scapy:%s\n" % (stream[key].command())) | ||
except: | ||
raise ValueError("Failed to eval '%s' for '%s'" % (fields[1], key)) | ||
|
||
|
@@ -698,8 +687,6 @@ def sanitize_profiler_value(value): | |
def trex_profiler_process_sample(sample, stats, prev_sample): | ||
sample = json.loads(sample) | ||
prev_sample = json.loads(prev_sample) | ||
#print(dump_json_readable(sample)) | ||
#print(dump_json_readable(prev_sample)) | ||
|
||
stats[sample['timestamp']]['tsdelta'] = sample['timestamp_delta'] | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what is the side affect of this? I'm guessing Mellanox can't be used at all on the TRex side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this actually allows us to use Mellanox without TRex complaining.