run_interactive module¶
-
class
run_interactive.BlackWidowInteractive(completekey='tab', stdin=None, stdout=None)[source]¶ Bases:
cmd.CmdCommand module to run the simulator in interactive mode.
This class runs the simulator in interactive mode and supports various command.
Attributes
intro Methods
create_network([settings, f])Initializes the network and bw variables. default(line)Overrides the default method on the base class to provide shortcut aliases for commands. do_EOF(line)Ends the program. do_add_flow(line)Adds a flow. do_add_host(line)Adds multiple hosts. do_add_link(line)Adds a link. do_add_router(line)Adds multiple routers. do_clear(line)Clears the graph. do_close(line)Closes the graph. do_delete_device(line)Deletes multiple devices. do_delete_flow(line)Deletes mulitple flows. do_delete_link(line)Deletes multiple links. do_dump(line)Saves the network to a file. do_exit(line)Ends the program. do_load(line)Loads a file. do_reset(line)Resets network do_reset_v(line)Resets parameters for interactive do_run(line)Runs the network. do_set_dpi(line)Sets the dpi to show the network. do_set_output(line)Sets network graph textual behavior. do_set_proj(line)Sets the projection to show the network. do_set_routing_packet_size(line)Sets routing packet size. do_set_show(line)Sets network graph display behavior. do_set_static_routing(line)Sets static routing. do_set_tcp_alg(line)Sets TCP algorithm. do_set_verbose(line)Sets verbose output. do_show(line)Shows the network. do_stop(line)Stops the network. help_EOF()Prints help message for EOF command help_add_flow()Prints help message for add_flow command help_add_host()Prints help message for add_host command help_add_link()Prints help message for add_link command help_add_router()Prints help message for add_router command help_clear()Prints help message for clear command help_close()Prints help message for close command help_delete_device()Prints help message for delete_device command help_delete_flow()Prints help message for delete_flow command help_delete_link()Prints help message for delete_link command help_dump()Prints help message for dump command help_exit()Prints help message for exit command help_load()Prints help message for load command help_reset()Prints help message for reset command help_reset_v()Prints help message for reset_v command help_run()Prints help message for run command help_set_dpi()Prints help message for set_dpi command help_set_output()Prints help message for set_output command help_set_proj()Prints help message for set_proj command help_set_routing_packet_size()Prints help message for set_routing_packet_size command help_set_show()Prints help message for set_show command help_set_static_routing()Prints help message for set_static_routing command help_set_tcp_alg()Prints help message for set_tcp_alg command help_set_verbose()Prints help message for set_verbose command help_show()Prints help message for show command help_stop()Prints help message for stop command -
create_network(settings=None, f=None)[source]¶ Initializes the network and bw variables.
Parameters: settings : dict, optional
A dictionary of settings (the default is None). See Blackwidow for valid values.
f : string, optional
The filename containing the network (the default is None).
-
default(line)[source]¶ Overrides the default method on the base class to provide shortcut aliases for commands.
Commands can be entered by typing partial commands that identify a command uniquely.
Parameters: line : string
String containing command and argument
-
do_EOF(line)[source]¶ Ends the program.
Parameters: line : string
A string containing command line arguments. Ignored.
-
do_add_flow(line)[source]¶ Adds a flow.
Parameters: line : string
A string containing command line arguments. See help_add_flow.
-
do_add_host(line)[source]¶ Adds multiple hosts.
Parameters: line : string
A string containing command line arguments. See help_add_host.
-
do_add_link(line)[source]¶ Adds a link.
Parameters: line : string
A string containing command line arguments. See help_add_link.
-
do_add_router(line)[source]¶ Adds multiple routers.
Parameters: line : string
A string containing command line arguments. See help_add_router.
-
do_clear(line)[source]¶ Clears the graph.
Parameters: line : string
A string containing command line arguments. Ignored.
-
do_close(line)[source]¶ Closes the graph.
Parameters: line : string
A string containing command line arguments. Ignored.
-
do_delete_device(line)[source]¶ Deletes multiple devices.
Parameters: line : string
A string containing command line arguments. See help_delete_device.
-
do_delete_flow(line)[source]¶ Deletes mulitple flows.
Parameters: line : string
A string containing command line arguments. See help_delete_flow.
-
do_delete_link(line)[source]¶ Deletes multiple links.
Parameters: line : string
A string containing command line arguments. See help_delete_link.
-
do_dump(line)[source]¶ Saves the network to a file.
Parameters: line : string
A string containing command line arguments. See help_dump.
-
do_exit(line)[source]¶ Ends the program.
Parameters: line : string
A string containing command line arguments. Ignored.
-
do_load(line)[source]¶ Loads a file.
Parameters: line : string
A string containing command line arguments. See help_load.
-
do_reset(line)[source]¶ Resets network
Parameters: line : string
A string containing command line arguments. Ignored.
-
do_reset_v(line)[source]¶ Resets parameters for interactive
Parameters: line : string
A string containing command line arguments. Ignored.
-
do_run(line)[source]¶ Runs the network.
Parameters: line : string
A string containing command line arguments. Ignored.
-
do_set_dpi(line)[source]¶ Sets the dpi to show the network.
Parameters: line : string
A string containing command line arguments. See help_set_dpi.
-
do_set_output(line)[source]¶ Sets network graph textual behavior.
Parameters: line : string
A string containing command line arguments. See help_set_output.
-
do_set_proj(line)[source]¶ Sets the projection to show the network.
Parameters: line : string
A string containing command line arguments. See help_set_proj.
-
do_set_routing_packet_size(line)[source]¶ Sets routing packet size.
Parameters: line : string
A string containing command line arguments. See help_set_routing_packet_size.
-
do_set_show(line)[source]¶ Sets network graph display behavior.
Parameters: line : string
A string containing command line arguments. See help_set_show.
-
do_set_static_routing(line)[source]¶ Sets static routing.
Parameters: line : string
A string containing command line arguments. See help_set_static_routing.
-
do_set_tcp_alg(line)[source]¶ Sets TCP algorithm.
Parameters: line : string
A string containing command line arguments. See help_set_tcp_alg.
-
do_set_verbose(line)[source]¶ Sets verbose output.
Parameters: line : string
A string containing command line arguments. See help_set_verbose.
-
do_show(line)[source]¶ Shows the network.
Parameters: line : string
A string containing command line arguments. Ignored.
-
-
run_interactive.check_args(args, n)[source]¶ Checks the provided list of args.
Checks if the provided list of args has the correct number of args.
Parameters: args : list
A list of strings.
n : int
The number of arguments that should be provided.
Returns: boolean
Returns True if the number of args is correct, or False otherwise.