blackwidow package¶
Subpackages¶
- blackwidow.graph package
- blackwidow.network package
- Submodules
- blackwidow.network.device module
- blackwidow.network.event module
- blackwidow.network.fast_flow module
- blackwidow.network.flow module
- blackwidow.network.host module
- blackwidow.network.link module
- blackwidow.network.network module
- blackwidow.network.packet module
- blackwidow.network.rate_graph module
- blackwidow.network.reno_flow module
- blackwidow.network.router module
- blackwidow.network.tahoe_flow module
- blackwidow.parser package
Submodules¶
blackwidow.blackwidow module¶
-
class
blackwidow.blackwidow.
BlackWidow
(settings={})[source]¶ Bases:
object
Runs simulation based on settings.
Generalizes Python’s print to adapt to custom settings, and direct different types of messages to different outputs including files, or functions that dynamically generate graphs.
Parameters: settings : dict
- Contains settings to initialize the printer. Values include:
- real_time : bool
Whether to graph in real time or write to files.
- show_verbose : bool
Whether to print statements labelled verbose.
- log_file : str
Name of file to write to. This is the prefix for all data types written to files. See documentation for write for more information.
- data_dir : str
Directory where the data is stored.
- static_routing : bool
Whether to use static routing.
- routing_packet_size : int
Size of routing packets.
- tcp_alg : str
Which TCP algorithm to use. Must be ‘Reno’, ‘Fast’, or ‘Tahoe’.
Methods
run(file_name) Runs the overall simulation based on settings specified when the BlackWidow object is constructed. print_verbose(msg) Handles a verbose message based on specified settings. record(data, data_type) Records data based on specified settings. Examples >>> from blackwidow import BlackWidow
>>> settings = {'filename': 'case0.json' ... }
>>> bw = BlackWidow(settings)
>>> bw.run()
-
print_verbose
(msg)[source]¶ Handles a verbose message based on specified settings.
Parameters: msg : str
Message to show.
-
record
(data, data_type)[source]¶ Records data based on specified settings.
Parameters: data : str
Data point to record/plot.
data_type : str
Type of data, will be used as a file extension.
Notes
- Standard data types:
- link.drop - “Time in ms”, “Number of drops” link.sent - “Time in ms”, “Number of packets sent” flow.window - “Time in ms”, “Window size” flow.sent - “Time in ms”, “Mega bits” flow.delay - “Time in ms”, “Delay in ms”
-
run
(file_name)[source]¶ Runs the overall simulation based on settings specified when the BlackWidow object is constructed.
Parameters: file_name : string
Name of config file containing network.
Returns: sim_time : float
The amount of time taken for the network to finish running.