diff options
author | Luc Provoost <luc.provoost@intel.com> | 2020-05-15 11:51:56 +0200 |
---|---|---|
committer | Luc Provoost <luc.provoost@intel.com> | 2020-05-15 11:55:09 +0200 |
commit | 8f21fb5ed8231125bca3cec1329d9fd739f14684 (patch) | |
tree | 2644761fd8e751060dfa41021eb4ce577b16f9a3 /VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py | |
parent | 9d4e94ed8cbd2110cab0388181bad3223a1155ce (diff) |
Support for imix packet sizes
All packet size in the *.test files have been replaces with imix sizes.
imix is now a list of packet sizes. If you want to run with only a
pakcet size of 64, you need to specify a list containing only 1 size:
[64].
You can also specify multiple imix values by specifying a list of list
of sizes. The keyworkds in the test files are now imix & imixs.
Change-Id: Iea47c0266b022133b7bbfc9a6811e3199ae41521
Signed-off-by: Luc Provoost <luc.provoost@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py')
-rw-r--r-- | VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py index 2a5b51c4..cfd0bb11 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py @@ -78,20 +78,37 @@ class RapidGeneratorMachine(RapidMachine): speed_per_gen_core = speed / len(self.machine_params['gencores']) self.socket.speed(speed_per_gen_core, self.machine_params['gencores']) - def set_udp_packet_size(self, frame_size): + def set_udp_packet_size(self, imix_frame_sizes): # We should check the gen.cfg to make sure we only send UDP packets - # Frame size = PROX pkt size + 4 bytes CRC - # The set_size function takes the PROX packet size as a parameter - self.socket.set_size(self.machine_params['gencores'], 0, frame_size - 4) - # 18 is the difference between the frame size and IP size = size of (MAC addresses, ethertype and FCS) - self.socket.set_value(self.machine_params['gencores'], 0, 16, frame_size-18, 2) - # 38 is the difference between the frame size and UDP size = 18 + size of IP header (=20) - self.socket.set_value(self.machine_params['gencores'], 0, 38, frame_size-38, 2) + # If only 1 packet size, still using the 'old' way of setting the + # packet sizes in PROX. Otherwise, using the 'new' way which + # automatically sets IP and UDP sizes. We should switch to the new way + # eventually for all cases. + if len(imix_frame_sizes) == 1: + # Frame size = PROX pkt size + 4 bytes CRC + # The set_size function takes the PROX packet size as a parameter + self.socket.set_size(self.machine_params['gencores'], 0, + imix_frame_sizes[0] - 4) + # 18 is the difference between the frame size and IP size = + # size of (MAC addresses, ethertype and FCS) + self.socket.set_value(self.machine_params['gencores'], 0, 16, + imix_frame_sizes[0] - 18, 2) + # 38 is the difference between the frame size and UDP size = + # 18 + size of IP header (=20) + self.socket.set_value(self.machine_params['gencores'], 0, 38, + imix_frame_sizes[0] - 38, 2) + else: + prox_sizes = [frame_size - 4 for frame_size in imix_frame_sizes] + self.socket.set_imix(self.machine_params['gencores'], 0, + prox_sizes) def set_flows(self, number_of_flows): - source_port,destination_port = RandomPortBits.get_bitmap(number_of_flows) - self.socket.set_random(self.machine_params['gencores'],0,34,source_port,2) - self.socket.set_random(self.machine_params['gencores'],0,36,destination_port,2) + source_port,destination_port = RandomPortBits.get_bitmap( + number_of_flows) + self.socket.set_random(self.machine_params['gencores'],0,34, + source_port,2) + self.socket.set_random(self.machine_params['gencores'],0,36, + destination_port,2) def start_gen_cores(self): self.socket.start(self.machine_params['gencores']) |