2022-12-23 12:21:42 +00:00
|
|
|
# System Imports
|
2022-12-28 11:59:56 +00:00
|
|
|
system_variables = import_module("github.com/logos-co/wakurtosis/src/system_variables.star")
|
2022-12-01 16:38:36 +00:00
|
|
|
|
2022-12-23 12:21:42 +00:00
|
|
|
# Module Imports
|
|
|
|
waku = import_module(system_variables.WAKU_MODULE)
|
|
|
|
prometheus = import_module(system_variables.PROMETHEUS_MODULE)
|
|
|
|
grafana = import_module(system_variables.GRAFANA_MODULE)
|
2023-01-04 13:18:05 +00:00
|
|
|
args_parser = import_module(system_variables.ARGUMENT_PARSER_MODULE)
|
2022-12-28 10:09:29 +00:00
|
|
|
wsl = import_module(system_variables.WSL_MODULE)
|
2022-12-19 16:56:38 +00:00
|
|
|
|
2022-12-12 15:23:47 +00:00
|
|
|
def run(args):
|
2023-01-04 13:18:05 +00:00
|
|
|
|
|
|
|
# Load global config file
|
2023-01-05 17:35:05 +00:00
|
|
|
config_file = args_parser.load_config_args(args)
|
|
|
|
config_json = read_file(src=config_file)
|
2023-01-04 13:18:05 +00:00
|
|
|
config = json.decode(config_json)
|
2022-12-12 15:23:47 +00:00
|
|
|
|
2023-01-04 13:18:05 +00:00
|
|
|
print(config)
|
2022-12-20 11:09:21 +00:00
|
|
|
|
2023-01-04 13:18:05 +00:00
|
|
|
same_toml_configuration = config['same_toml_configuration']
|
|
|
|
|
|
|
|
# Load network topology
|
|
|
|
waku_topology_json = read_file(src=system_variables.TOPOLOGIES_LOCATION + config['topology_file'])
|
|
|
|
waku_topology = json.decode(waku_topology_json)
|
2022-12-12 15:23:47 +00:00
|
|
|
|
2022-12-23 12:21:42 +00:00
|
|
|
# Set up nodes
|
2022-12-23 16:07:01 +00:00
|
|
|
waku_services = waku.instantiate_waku_nodes(waku_topology, same_toml_configuration)
|
2022-12-16 12:13:12 +00:00
|
|
|
|
|
|
|
# Set up prometheus + graphana
|
2022-12-23 16:07:01 +00:00
|
|
|
prometheus_service = prometheus.set_up_prometheus(waku_services)
|
2022-12-23 12:21:42 +00:00
|
|
|
grafana_service = grafana.set_up_graphana(prometheus_service)
|
2022-12-01 16:38:36 +00:00
|
|
|
|
2022-12-23 16:07:01 +00:00
|
|
|
waku.interconnect_waku_nodes(waku_topology, waku_services)
|
2022-12-15 13:56:59 +00:00
|
|
|
|
2022-12-28 11:59:56 +00:00
|
|
|
# waku.send_test_messages(waku_topology, system_variables.NUMBER_TEST_MESSAGES,
|
|
|
|
# system_variables.DELAY_BETWEEN_TEST_MESSAGE)
|
2022-12-15 13:56:59 +00:00
|
|
|
|
2022-12-28 11:59:56 +00:00
|
|
|
# waku.get_waku_peers(waku_topology.keys()[1])
|
2022-12-23 16:07:01 +00:00
|
|
|
|
|
|
|
# Setup WSL & Start the Simulation
|
2023-01-04 13:18:05 +00:00
|
|
|
wsl_service = wsl.set_up_wsl(waku_services, config['simulation_time'], config['message_rate'], config['min_packet_size'], config['max_packet_size'])
|