byteblower_test_framework.run module
Test runners for the ByteBlower Traffic Generator.
- class byteblower_test_framework.run.Scenario
Bases:
object
ByteBlower Test Scenario interface.
Changed in version 1.2.0: The scenario runtime has been improved with addition of ByteBlower Endpoint support.
- add_report(report: ByteBlowerReport) None
- property duration: datetime | None
Return the actual duration of the last Scenario run.
The duration is calculated as
start_timestamp()
-end_timestamp()
.- Returns:
Actual duration of the last run.
- Return type:
Optional[datetime]
- property end_timestamp: datetime | None
Return the timestamp when the Scenario was finished.
The end timestamp is the timestamp right after stopping the flows and analysing the final results. This is logged at the end of the
Scenario.run()
call.Note
The time between flow analysis and flow and endpoint cleanup is not taken into account here.
- Returns:
End time of the last run
- Return type:
Optional[datetime]
- property flows: Sequence[Flow]
Returns the list of flows added to this Scenario.
- Returns:
List of added flows.
- Return type:
List[Flow]
- release() None
Release all resources used on the ByteBlower system.
Releases all resources related to traffic generation and analysis.
Note
The ByteBlower Ports / Endpoints themselves are not released.
- run(maximum_run_time: timedelta | None = None, wait_for_finish: timedelta | None = None, duration: timedelta | None = None) None
Run the scenario.
if
max_run_time
is specified, the scenario will limit the run time (initial time to wait + duration) of all flows. The scenario will stop after themax_run_time
has passed. Also flow which are not duration-based will be stopped.If the
max_run_time
is not specified it will run for the the time of the flow with the longest run time (initial time to wait + duration). The scenario will wait (indefinitely) for any non duration-based flow to finish.
The
duration
parameter is kept for backward compatibility with older (beta) versions of the ByteBlower Test Framework. It will be removed definitely with the final version 1.0 release.- Parameters:
maximum_run_time (Optional[timedelta], optional) – maximum run time of the scenario, defaults to None
wait_for_finish (timedelta, optional) – Time to wait for sessions closing and final packets being received, defaults to timedelta(seconds=5)
duration (Optional[timedelta], optional) – Backward-compatible parameter for the
max_run_time
, defaults to None
Changed in version 1.2.0: The Scenario runtime has been improved with addition of ByteBlower Endpoint support.
Address resolution and NAT/NAPT discovery is now part of the “prepare flow configuration” step (see also
Flow.prepare_configure()
instead of flow construction (Flow.__init__()
).The scenario will wait for (maximum
DEFAULT_RESULT_TIMEOUT
) to let all ByteBlower Endpoint finish scenario execution and return their results to the Meeting Point.
- property start_timestamp: datetime | None
Return the timestamp when the Scenario was started.
The start timestamp is the timestamp right before starting the flows. This is logged at the start of the
Scenario.run()
call.Note
The time between endpoint and flow initialization is not taken into account here.
- Returns:
Start timestamp of the last run
- Return type:
Optional[datetime]