super(TGDropRateSearchImpl, self).__init__()
def measure_loss(self, rate, frame_size, loss_acceptance,
super(TGDropRateSearchImpl, self).__init__()
def measure_loss(self, rate, frame_size, loss_acceptance,
"""Runs the traffic and evaluate the measured results.
:param rate: Offered traffic load.
:param frame_size: Size of frame.
:param loss_acceptance: Permitted drop ratio or frames count.
:param loss_acceptance_type: Type of permitted loss.
"""Runs the traffic and evaluate the measured results.
:param rate: Offered traffic load.
:param frame_size: Size of frame.
:param loss_acceptance: Permitted drop ratio or frames count.
:param loss_acceptance_type: Type of permitted loss.
See resources/traffic_profiles/trex for implemented modules.
:param skip_warmup: Start TRex without warmup traffic if true.
:type rate: float
:type frame_size: str
:type loss_acceptance: float
:type loss_acceptance_type: LossAcceptanceType
See resources/traffic_profiles/trex for implemented modules.
:param skip_warmup: Start TRex without warmup traffic if true.
:type rate: float
:type frame_size: str
:type loss_acceptance: float
:type loss_acceptance_type: LossAcceptanceType
loss = tg_instance.get_loss()
sent = tg_instance.get_sent()
if self.loss_acceptance_type_is_percentage():
loss = tg_instance.get_loss()
sent = tg_instance.get_sent()
if self.loss_acceptance_type_is_percentage():
- self, duration, rate, framesize, traffic_type, async_call=False,
+ self, duration, rate, frame_size, traffic_profile, async_call=False,
latency=True, warmup_time=5.0, unidirection=False, tx_port=0,
rx_port=1):
"""Execute script on remote node over ssh to start traffic.
:param duration: Time expresed in seconds for how long to send traffic.
:param rate: Traffic rate expressed with units (pps, %)
latency=True, warmup_time=5.0, unidirection=False, tx_port=0,
rx_port=1):
"""Execute script on remote node over ssh to start traffic.
:param duration: Time expresed in seconds for how long to send traffic.
:param rate: Traffic rate expressed with units (pps, %)
- :param framesize: L2 frame size to send (without padding and IPG).
- :param traffic_type: Module name as a traffic type identifier.
+ :param frame_size: L2 frame size to send (without padding and IPG).
+ :param traffic_profile: Module name as a traffic profile identifier.
See resources/traffic_profiles/trex for implemented modules.
:param async_call: If enabled then don't wait for all incomming trafic.
:param latency: With latency measurement.
See resources/traffic_profiles/trex for implemented modules.
:param async_call: If enabled then don't wait for all incomming trafic.
:param latency: With latency measurement.
command = (
"sh -c '{tool}/resources/tools/trex/trex_stateless_profile.py"
" --profile {prof}/resources/traffic_profiles/trex/{traffic}.py"
command = (
"sh -c '{tool}/resources/tools/trex/trex_stateless_profile.py"
" --profile {prof}/resources/traffic_profiles/trex/{traffic}.py"
" --warmup_time {warmup} --port_0 {p_0} --port_1 {p_1}").format(
tool=Constants.REMOTE_FW_DIR, prof=Constants.REMOTE_FW_DIR,
" --warmup_time {warmup} --port_0 {p_0} --port_1 {p_1}").format(
tool=Constants.REMOTE_FW_DIR, prof=Constants.REMOTE_FW_DIR,
- traffic=traffic_type, duration=duration, framesize=framesize,
- rate=rate, warmup=warmup_time, p_0=p_0, p_1=p_1)
+ traffic=traffic_profile, duration=duration,
+ frame_size=frame_size, rate=rate, warmup=warmup_time, p_0=p_0,
+ p_1=p_1)
- self, duration, rate, framesize, traffic_type, warmup_time=5,
+ self, duration, rate, frame_size, traffic_profile, warmup_time=5,
async_call=False, latency=True, unidirection=False, tx_port=0,
rx_port=1):
"""Send traffic from all configured interfaces on TG.
async_call=False, latency=True, unidirection=False, tx_port=0,
rx_port=1):
"""Send traffic from all configured interfaces on TG.
TODO: Is it better to have less descriptive argument names
just to make them less probable to be viewed as misleading or confusing?
TODO: Is it better to have less descriptive argument names
just to make them less probable to be viewed as misleading or confusing?
:param duration: Duration of test traffic generation in seconds.
:param rate: Offered load per interface (e.g. 1%, 3gbps, 4mpps, ...).
:param duration: Duration of test traffic generation in seconds.
:param rate: Offered load per interface (e.g. 1%, 3gbps, 4mpps, ...).
- :param framesize: Frame size (L2) in Bytes.
- :param traffic_type: Module name as a traffic type identifier.
+ :param frame_size: Frame size (L2) in Bytes.
+ :param traffic_profile: Module name as a traffic profile identifier.
See resources/traffic_profiles/trex for implemented modules.
:param warmup_time: Warmup phase in seconds.
:param async_call: Async mode.
See resources/traffic_profiles/trex for implemented modules.
:param warmup_time: Warmup phase in seconds.
:param async_call: Async mode.
raise RuntimeError('TG subtype not defined')
elif node['subtype'] == NodeSubTypeTG.TREX:
self.trex_stl_start_remote_exec(
raise RuntimeError('TG subtype not defined')
elif node['subtype'] == NodeSubTypeTG.TREX:
self.trex_stl_start_remote_exec(
- duration, rate, framesize, traffic_type, async_call, latency,
- warmup_time, unidirection, tx_port, rx_port)
+ duration, rate, frame_size, traffic_profile, async_call,
+ latency, warmup_time, unidirection, tx_port, rx_port)
- def set_rate_provider_defaults(self, frame_size, traffic_type,
+ def set_rate_provider_defaults(self, frame_size, traffic_profile,
See resources/traffic_profiles/trex for implemented modules.
:param warmup_time: Traffic duration before measurement starts [s].
:type frame_size: str or int
See resources/traffic_profiles/trex for implemented modules.
:param warmup_time: Traffic duration before measurement starts [s].
:type frame_size: str or int
self.warmup_time = float(warmup_time)
def measure(self, duration, transmit_rate):
self.warmup_time = float(warmup_time)
def measure(self, duration, transmit_rate):
# Trex needs target Tr per stream, but reports aggregate Tx and Dx.
unit_rate = str(transmit_rate / 2.0) + "pps"
self.send_traffic_on_tg(
# Trex needs target Tr per stream, but reports aggregate Tx and Dx.
unit_rate = str(transmit_rate / 2.0) + "pps"
self.send_traffic_on_tg(
- duration, unit_rate, self.frame_size, self.traffic_type,
+ duration, unit_rate, self.frame_size, self.traffic_profile,
warmup_time=self.warmup_time, latency=True)
transmit_count = int(self.get_sent())
loss_count = int(self.get_loss())
warmup_time=self.warmup_time, latency=True)
transmit_count = int(self.get_sent())
loss_count = int(self.get_loss())
- frame_size, traffic_type, minimum_transmit_rate,
+ frame_size, traffic_profile, minimum_transmit_rate,
maximum_transmit_rate, packet_loss_ratio=0.005,
final_relative_width=0.005, final_trial_duration=30.0,
initial_trial_duration=1.0, number_of_intermediate_phases=2,
maximum_transmit_rate, packet_loss_ratio=0.005,
final_relative_width=0.005, final_trial_duration=30.0,
initial_trial_duration=1.0, number_of_intermediate_phases=2,
"""Setup initialized TG, perform optimized search, return intervals.
:param frame_size: Frame size identifier or value [B].
"""Setup initialized TG, perform optimized search, return intervals.
:param frame_size: Frame size identifier or value [B].
See resources/traffic_profiles/trex for implemented modules.
:param minimum_transmit_rate: Minimal bidirectional
target transmit rate [pps].
See resources/traffic_profiles/trex for implemented modules.
:param minimum_transmit_rate: Minimal bidirectional
target transmit rate [pps].
Default 1 is suitable for fairly stable tests,
less stable tests might get better overal duration with 2 or more.
:type frame_size: str or int
Default 1 is suitable for fairly stable tests,
less stable tests might get better overal duration with 2 or more.
:type frame_size: str or int
:type minimum_transmit_rate: float
:type maximum_transmit_rate: float
:type packet_loss_ratio: float
:type minimum_transmit_rate: float
:type maximum_transmit_rate: float
:type packet_loss_ratio: float
# to be able to use trex_stl-*()
tg_instance = BuiltIn().get_library_instance(
'resources.libraries.python.TrafficGenerator')
# to be able to use trex_stl-*()
tg_instance = BuiltIn().get_library_instance(
'resources.libraries.python.TrafficGenerator')
algorithm = MultipleLossRatioSearch(
measurer=tg_instance, final_trial_duration=final_trial_duration,
final_relative_width=final_relative_width,
algorithm = MultipleLossRatioSearch(
measurer=tg_instance, final_trial_duration=final_trial_duration,
final_relative_width=final_relative_width,
- frame_size, traffic_type, minimum_transmit_rate,
+ frame_size, traffic_profile, minimum_transmit_rate,
maximum_transmit_rate, plr_target=1e-7, tdpt=0.2,
initial_count=50, timeout=1800.0):
"""Setup initialized TG, perform soak search, return avg and stdev.
:param frame_size: Frame size identifier or value [B].
maximum_transmit_rate, plr_target=1e-7, tdpt=0.2,
initial_count=50, timeout=1800.0):
"""Setup initialized TG, perform soak search, return avg and stdev.
:param frame_size: Frame size identifier or value [B].
See resources/traffic_profiles/trex for implemented modules.
:param minimum_transmit_rate: Minimal bidirectional
target transmit rate [pps].
See resources/traffic_profiles/trex for implemented modules.
:param minimum_transmit_rate: Minimal bidirectional
target transmit rate [pps].
takes significant time even without any trial results.
:param timeout: The search will stop after this overall time [s].
:type frame_size: str or int
takes significant time even without any trial results.
:param timeout: The search will stop after this overall time [s].
:type frame_size: str or int
algorithm = PLRsearch(
measurer=tg_instance, trial_duration_per_trial=tdpt,
packet_loss_ratio_target=plr_target,
algorithm = PLRsearch(
measurer=tg_instance, trial_duration_per_trial=tdpt,
packet_loss_ratio_target=plr_target,