Command Line Launcher
The command-line launcher tgcrawl.py:
Retrieves any command-line arguments
Sets default values for all parameters which fine-tune the program’s operation.
Optionally reads a configuration TOML file to override the default values of these parameters
Reads a network descriptor text file which provides the range of IP addresses (over which to crawl), as well as log-in credentials for the radios.
Calls the batch engine main API:
TgCrawler.
Module Information
A Command line launcher for TgCrawl.
- class tgtools.tgcrawl.CrawlLauncher(**kwargs)
The main API for launching the TgCrawl from the command line.
- __init__(**kwargs)
Collect all program attributes, including command line arguments, and parameters specified in some ancilliary configuration text files.
- get_credentials() Credentials
Read the network description (IP addresses, log-in credentials) from file
network_filename. Automatically called by__init__().
- read_script_file() list[str]
Read script file
send_cmds_script_filename. Automatically called byvalidate().- Return type:
list[str]
- read_toml_config()
Get program configurations from TOML file
configs_filename, and attempt to override the default running parameters. Automatically called by__init__().
- run()
Validate parameters, print a summary of pending actions, and run the TgCrawl batch engine (as determined by
mode: either once, or repeatedly (polling).
- validate() bool
Validate coherency of all attributes:
Action includes at least some radios (local and/or remote).
The network descriptor file is read and parsed
If required, read
send_cmds_script_filenameintosend_script_cmds.
Automatically run by
run().- Return type:
bool
- action_local: bool
Action IP-accessible radios (whose IP addresses are denoted in
network_filename). Default: True (but may be overridden byconfig_filename).
- action_remote_cns: bool
Action IP-less radios (remote Client Nodes without a network-accessible IP address). Default: True (but may be overridden by
config_filename).
- action_remote_cns_list: list | None
Applicable if
action_remote_cnsisTrue: List of remote radio names for actions. If None: remote radios are automatically discovered and actions are applied to them all. Default: None (but may be overridden byconfig_filename).
- concurrency: bool
If
True: access radios concurrently (multiple threads); else: sequentially. Default: True (but may be overridden byconfig_filename).
- concurrency_threads: int
Applicable if
concurrencyisTrue: maximum number of concurrent threads. Default: 10 (but may be overridden byconfig_filename).
- config_filename: str
Name of TOML file overriding default running parameters. Default: ‘configs.toml’.
- credentials: Credentials
Network credentials, as read from
get_credentials().
- debug_print: bool
Run with additional output to console Default: True (but may be overridden by
config_filename).
- dir_get_configs: str
Directory to save config files fetched from radios. Default: ‘configs’ (but may be overridden by
config_filename).
- dir_get_events: str
Directory to save events files fetched from radios. Default: ‘events’ (but may be overridden by
config_filename).
- dir_get_status: str
Directory to save parsed status (telemetry) files fetched from radios. Default: ‘get_status’ (but may be overridden by
config_filename).
- dir_get_status_xml: str
Directory to save raw XML telemetry files fetched from radios. Default: ‘get_status_xml’ (but may be overridden by
config_filename).
- dir_get_tech_logs: str
Directory to save tech_log files fetched from radios. Default: ‘configs’ (but may be overridden by
config_filename).
- dir_output_root: str
Path to output root directory. Default: ‘output’ (but may be overridden by
config_filename).
- get_configs: bool
Actions to include fetching configuration from radio. Default: False (but may be overridden by
config_filename).
- get_configs_db: str
Applicable if
get_configsisTrue: type of configuration to fetch. Default: ‘startup’ (but may be overridden byconfig_filename).
- get_configs_max_files: int
Applicable if
get_configsisTrue: maximum number of files to save before rolling over. Default: 3 (but may be overridden byconfig_filename).
- get_events: bool
Actions to include fetching events from radio. Default: True (but may be overridden by
config_filename).
- get_status: bool
Actions to include fetching comprehensive telemetry from radio, parsing and saving. Default: True (but may be overridden by
config_filename).
- get_status_xml: bool
Applicable if
get_statusisTrue: Save the raw XML response from radio. Default: False (but may be overridden byconfig_filename).
- get_status_xml_max_files: int
Applicable if
get_statusisTrue: maximum number of files to save before rolling over. Default: 3 (but may be overridden byconfig_filename).
- get_tech_log_max_files: int
Applicable if
get_tech_logsisTrue: maximum number of files to save before rolling over. Default: 10 (but may be overridden byconfig_filename).
- get_tech_logs: bool
Actions to include fetching the tech_log from radio. Default: False (but may be overridden by
config_filename).
- interactive: bool
Run in interactive mode. Default: True.
- iteration_period
Applicable if
modeis ‘poll’: Period of iterations. Default: 5 minutes (but may be overridden byconfig_filename).
- logger
Console logger for this class.
- mode: str
Mode of operation. Default: ‘once’.
- network_filename: str
Name of file describing the network over which TgCrawl will ‘crawl’. Default: ‘network.txt’.
- num_iterations: int
Applicable if
modeis ‘poll’: Number of iterations (value of zero means: forever). Default: 0 (but may be overridden byconfig_filename).
- send_cmds: bool
Actions to include sending a command script to radio. Default: False (but may be overridden by
config_filename).
- send_cmds_script_filename: str
Applicable if
send_cmdsisTrue: name of file containing the script. Default: ‘script.txt’ (but may be overridden byconfig_filename).
- send_script_cmds: list[str]
Script commands as read from
send_cmds_script_filename. Defaults to an empty list.
- set_tod: bool
Actions to include setting the radio’s date and time based on the computer’s clock. Default: False (but may be overridden by
config_filename).
- set_tod_shift: float
Applicable if
set_todisTrue: a time shift (in hours) for cases where the computer is in a different timezone relative to the radios. Default: 0 (but may be overridden byconfig_filename).
- silent: bool
Run in silent mode. Default: False.
- tgtools.tgcrawl.main()
Interpret command line and launch appropriate program