mirror of https://github.com/vacp2p/wakurtosis.git
Add multiple nomos nodes per container support
This commit is contained in:
parent
de84b28a04
commit
7cda520f51
|
@ -35,12 +35,6 @@ nodeTypeToDocker = {
|
|||
nodeType.NOMOS: "nomos"
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
#NODES = [nodeType.NWAKU, nodeType.GOWAKU, nodeType.NOMOS]
|
||||
#NODE_PROBABILITIES = (0, 0, 100)
|
||||
|
||||
>>>>>>> b6a76d5 (Gennet and WSL changes for nomos node)
|
||||
# To add a new network type, add appropriate entries to the networkType and networkTypeSwitch
|
||||
# the networkTypeSwitch is placed before generate_network(): fwd declaration mismatch with typer/python :/
|
||||
class networkType(Enum):
|
||||
|
|
|
@ -32,8 +32,7 @@ def run(plan, args):
|
|||
|
||||
grafana_service = grafana.set_up_grafana(plan, prometheus_service)
|
||||
|
||||
# nomos.interconnect_nomos_nodes(plan, waku_topology, services)
|
||||
nodes.interconnect_nodes(plan, network_topology, services, interconnection_batch)
|
||||
nodes.interconnect_nodes(plan, network_topology, interconnection_batch)
|
||||
|
||||
# Setup WLS & Start the Simulation
|
||||
wls_service = wls.init(plan, network_topology, wls_config)
|
||||
|
|
|
@ -15,4 +15,38 @@ def send_json_rpc(plan, service_name, port_id, method, params, extract={}):
|
|||
assertion="==",
|
||||
target_value=200)
|
||||
|
||||
return response
|
||||
return response
|
||||
|
||||
|
||||
def send_http_get_req(plan, service_name, port_id, endpoint, extract={}):
|
||||
recipe = GetHttpRequestRecipe(
|
||||
service_name=service_name,
|
||||
port_id=port_id,
|
||||
endpoint=endpoint,
|
||||
extract=extract
|
||||
)
|
||||
|
||||
response = plan.wait(recipe=recipe,
|
||||
field="code",
|
||||
assertion="==",
|
||||
target_value=200)
|
||||
|
||||
return response
|
||||
|
||||
|
||||
def send_http_post_req(plan, service_name, port_id, endpoint, body, extract={}):
|
||||
recipe = PostHttpRequestRecipe(
|
||||
service_name=service_name,
|
||||
port_id=port_id,
|
||||
endpoint=endpoint,
|
||||
content_type="application/json",
|
||||
body=body,
|
||||
extract=extract
|
||||
)
|
||||
|
||||
response = plan.wait(recipe=recipe,
|
||||
field="code",
|
||||
assertion="==",
|
||||
target_value=200)
|
||||
|
||||
return response
|
||||
|
|
|
@ -1,206 +0,0 @@
|
|||
# System Imports
|
||||
system_variables = import_module("github.com/logos-co/wakurtosis/src/system_variables.star")
|
||||
|
||||
# Module Imports
|
||||
waku = import_module(vars.WAKU_MODULE)
|
||||
nomos = import_module(vars.NOMOS_MODULE)
|
||||
files = import_module(vars.FILE_HELPERS_MODULE)
|
||||
|
||||
|
||||
def prepare_nwaku_service(plan, nwakunode_name, all_services, use_general_configuration):
|
||||
artifact_id, configuration_file = files.get_toml_configuration_artifact(plan, nwakunode_name,
|
||||
use_general_configuration,
|
||||
nwakunode_name)
|
||||
|
||||
plan.print("Configuration being used file is " + configuration_file)
|
||||
|
||||
add_service_config = ServiceConfig(
|
||||
image=system_variables.NWAKU_IMAGE,
|
||||
ports={
|
||||
system_variables.WAKU_RPC_PORT_ID: PortSpec(number=system_variables.WAKU_TCP_PORT,
|
||||
transport_protocol="TCP"),
|
||||
system_variables.PROMETHEUS_PORT_ID: PortSpec(
|
||||
number=system_variables.PROMETHEUS_TCP_PORT,
|
||||
transport_protocol="TCP"),
|
||||
system_variables.WAKU_LIBP2P_PORT_ID: PortSpec(
|
||||
number=system_variables.WAKU_LIBP2P_PORT,
|
||||
transport_protocol="TCP"),
|
||||
},
|
||||
files={
|
||||
system_variables.CONTAINER_NODE_CONFIG_FILE_LOCATION: artifact_id
|
||||
},
|
||||
entrypoint=system_variables.NWAKU_ENTRYPOINT,
|
||||
cmd=[
|
||||
"--config-file=" + system_variables.CONTAINER_NODE_CONFIG_FILE_LOCATION + "/" + configuration_file
|
||||
]
|
||||
)
|
||||
|
||||
all_services[nwakunode_name] = add_service_config
|
||||
|
||||
|
||||
|
||||
def prepare_gowaku_service(plan, gowakunode_name, all_services, use_general_configuration):
|
||||
artifact_id, configuration_file = files.get_toml_configuration_artifact(plan, gowakunode_name,
|
||||
use_general_configuration,
|
||||
gowakunode_name)
|
||||
|
||||
plan.print("Configuration being used file is " + configuration_file)
|
||||
plan.print("Entrypoint is "+ str(system_variables.GOWAKU_ENTRYPOINT))
|
||||
|
||||
add_service_config = ServiceConfig(
|
||||
image=system_variables.GOWAKU_IMAGE,
|
||||
ports={
|
||||
system_variables.WAKU_RPC_PORT_ID: PortSpec(number=system_variables.WAKU_TCP_PORT,
|
||||
transport_protocol="TCP"),
|
||||
system_variables.PROMETHEUS_PORT_ID: PortSpec(
|
||||
number=system_variables.PROMETHEUS_TCP_PORT,
|
||||
transport_protocol="TCP"),
|
||||
system_variables.WAKU_LIBP2P_PORT_ID: PortSpec(
|
||||
number=system_variables.WAKU_LIBP2P_PORT,
|
||||
transport_protocol="TCP"),
|
||||
},
|
||||
files={
|
||||
system_variables.CONTAINER_NODE_CONFIG_FILE_LOCATION: artifact_id
|
||||
},
|
||||
entrypoint=system_variables.GOWAKU_ENTRYPOINT,
|
||||
cmd=[
|
||||
"--config-file=" + system_variables.CONTAINER_NODE_CONFIG_FILE_LOCATION + "/" + configuration_file
|
||||
]
|
||||
)
|
||||
|
||||
all_services[gowakunode_name] = add_service_config
|
||||
|
||||
|
||||
def prepare_nomos_service(node_name, all_services, config_file, artifact_id):
|
||||
nomos_service_config = ServiceConfig(
|
||||
image=vars.NOMOS_IMAGE,
|
||||
ports={
|
||||
vars.NOMOS_HTTP_PORT_ID: PortSpec(number=vars.NOMOS_HTTP_PORT,
|
||||
transport_protocol="TCP"),
|
||||
vars.PROMETHEUS_PORT_ID: PortSpec(
|
||||
number=vars.PROMETHEUS_TCP_PORT,
|
||||
transport_protocol="TCP"),
|
||||
vars.NOMOS_LIBP2P_PORT_ID: PortSpec(
|
||||
number=vars.NOMOS_LIBP2P_PORT,
|
||||
transport_protocol="TCP"),
|
||||
},
|
||||
files={
|
||||
vars.CONTAINER_NODE_CONFIG_FILE_LOCATION: artifact_id
|
||||
},
|
||||
entrypoint=vars.NOMOS_ENTRYPOINT,
|
||||
cmd=[
|
||||
vars.NOMOS_CONTAINER_CONFIG_FILE_LOCATION
|
||||
]
|
||||
)
|
||||
|
||||
all_services[node_name] = nomos_service_config
|
||||
|
||||
|
||||
def interconnect_nodes(plan, topology_information, services, interconnection_batch):
|
||||
for waku_service_name in services.keys():
|
||||
peers = topology_information[waku_service_name]["static_nodes"]
|
||||
|
||||
for i in range(0, len(peers), interconnection_batch):
|
||||
x = i
|
||||
image = services[waku_service_name]["image"]
|
||||
create_id = service_dispatcher[image].create_id
|
||||
connect_peers = service_dispatcher[image].connect_peers
|
||||
peer_ids = [create_id(services[peer]) for peer in peers[x:x + interconnection_batch]]
|
||||
|
||||
connect_peers(plan, waku_service_name, vars.WAKU_RPC_PORT_ID, peer_ids)
|
||||
|
||||
|
||||
def instantiate_services(plan, network_topology, testing):
|
||||
"""
|
||||
As we will need to access for the service information later, the structure is the following:
|
||||
|
||||
services = {
|
||||
"nwaku_0": {
|
||||
"peer_id" : peer id of the node, as string,
|
||||
"service_info": Kurtosis service struct, that has
|
||||
"ip": ip of the service that is running the node,
|
||||
"ports": Kurtosis PortSpec, that you can access with their respective identifier
|
||||
},
|
||||
"nwaku_1": {...},
|
||||
"gowaku_": {...}
|
||||
|
||||
}
|
||||
|
||||
Example:
|
||||
|
||||
service_peer_id = services["nwaku_0"]["peer_id"]
|
||||
service_ip = services["nwaku_0"]["service_info"].ip_address
|
||||
rpc_node_number = services["nwaku_0"]["service_info"].ports["your_rpc_identifier"].number
|
||||
rpc_node_protocol = services["nwaku_0"]["service_info"].ports["your_rpc_identifier"].protocol
|
||||
"""
|
||||
|
||||
all_services = {}
|
||||
|
||||
# Get up all nodes
|
||||
for service_name in network_topology.keys():
|
||||
image = network_topology[service_name]["image"]
|
||||
|
||||
service_builder = service_dispatcher[image].prepare_service
|
||||
|
||||
service_builder(plan, service_name, all_services, use_general_configuration)
|
||||
|
||||
all_services_information = plan.add_services(
|
||||
configs = all_services
|
||||
)
|
||||
services_information = add_services_information(plan, all_services_information, network_topology)
|
||||
|
||||
return services_information
|
||||
|
||||
|
||||
def add_services_information(plan, all_services_information, network_topology):
|
||||
new_services_information = {}
|
||||
|
||||
for service_name in all_services_information:
|
||||
image = network_topology[service_name]["image"]
|
||||
info_getter = service_dispatcher[image].add_service_information
|
||||
service_info = all_services_information[service_name]
|
||||
new_service_info = info_getter(plan, service_name, service_info)
|
||||
new_service_info["image"] = image
|
||||
new_services_information[service_name] = new_service_info
|
||||
|
||||
return new_services_information
|
||||
|
||||
|
||||
def _add_waku_service_information(plan, service_name, service_info):
|
||||
node_peer_id = waku.get_wakunode_peer_id(plan, service_name, vars.WAKU_RPC_PORT_ID)
|
||||
new_service_info = {}
|
||||
new_service_info["peer_id"] = node_peer_id
|
||||
new_service_info["service_info"] = service_info
|
||||
|
||||
return new_service_info
|
||||
|
||||
|
||||
def _add_nomos_service_information(plan, service_name, service_info):
|
||||
node_peer_id = nomos.get_nomos_peer_id(plan, service_name, vars.NOMOS_HTTP_PORT_ID)
|
||||
new_service_info = {}
|
||||
new_service_info["peer_id"] = node_peer_id
|
||||
new_service_info["service_info"] = service_info
|
||||
|
||||
return new_service_info
|
||||
|
||||
|
||||
service_dispatcher = {
|
||||
"go-waku": struct(
|
||||
prepare_service = prepare_gowaku_service,
|
||||
add_service_information = _add_waku_service_information,
|
||||
create_id = waku.create_waku_id,
|
||||
connect_peers = waku.connect_wakunode_to_peers
|
||||
),
|
||||
"nim-waku": struct(
|
||||
prepare_service = prepare_nwaku_service,
|
||||
add_service_information = _add_waku_service_information,
|
||||
create_id = waku.create_waku_id,
|
||||
connect_peers = waku.connect_wakunode_to_peers
|
||||
),
|
||||
"nomos": struct(
|
||||
prepare_service = prepare_nomos_service,
|
||||
add_service_information = _add_nomos_service_information,
|
||||
create_id = nomos.create_nomos_id,
|
||||
connect_peers = nomos.connect_nomos_to_peers
|
||||
),
|
||||
}
|
|
@ -3,22 +3,42 @@ vars = import_module("github.com/logos-co/wakurtosis/src/system_variables.star")
|
|||
|
||||
# Module Imports
|
||||
waku = import_module(vars.WAKU_MODULE)
|
||||
nomos = import_module(vars.NOMOS_MODULE)
|
||||
files = import_module(vars.FILE_HELPERS_MODULE)
|
||||
waku_builder = import_module(vars.WAKU_BUILDER_MODULE)
|
||||
nwaku_builder = import_module(vars.NWAKU_BUILDER_MODULE)
|
||||
gowaku_builder = import_module(vars.GOWAKU_BUILDER_MODULE)
|
||||
nomos_builder = import_module(vars.NOMOS_BUILDER_MODULE)
|
||||
|
||||
|
||||
service_builder_dispatcher = {
|
||||
vars.GENNET_GOWAKU_IMAGE_VALUE: gowaku_builder.prepare_gowaku_service,
|
||||
vars.GENNET_NWAKU_IMAGE_VALUE: nwaku_builder.prepare_nwaku_service
|
||||
# nomos: nomos_builder.prepare_nomos_service
|
||||
vars.GENNET_NWAKU_IMAGE_VALUE: nwaku_builder.prepare_nwaku_service,
|
||||
vars.GENNET_NOMOS_IMAGE_VALUE: nomos_builder.prepare_nomos_service
|
||||
}
|
||||
|
||||
service_info_dispatcher = {
|
||||
vars.GENNET_GOWAKU_IMAGE_VALUE: waku.get_wakunode_peer_id,
|
||||
vars.GENNET_NWAKU_IMAGE_VALUE: waku.get_wakunode_peer_id,
|
||||
vars.GENNET_NOMOS_IMAGE_VALUE: nomos.get_nomos_peer_id
|
||||
}
|
||||
|
||||
service_multiaddr_dispatcher = {
|
||||
vars.GENNET_GOWAKU_IMAGE_VALUE: waku.create_node_multiaddress,
|
||||
vars.GENNET_NWAKU_IMAGE_VALUE: waku.create_node_multiaddress,
|
||||
vars.GENNET_NOMOS_IMAGE_VALUE: nomos.create_node_multiaddress
|
||||
}
|
||||
|
||||
service_connect_dispatcher = {
|
||||
vars.GENNET_GOWAKU_IMAGE_VALUE: waku.connect_wakunode_to_peers,
|
||||
vars.GENNET_NWAKU_IMAGE_VALUE: waku.connect_wakunode_to_peers,
|
||||
vars.GENNET_NOMOS_IMAGE_VALUE: nomos.connect_nomos_to_peers
|
||||
}
|
||||
|
||||
ports_dispatcher = {
|
||||
vars.GENNET_GOWAKU_IMAGE_VALUE: waku_builder._add_waku_ports_info_to_topology,
|
||||
vars.GENNET_NWAKU_IMAGE_VALUE: waku_builder._add_waku_ports_info_to_topology
|
||||
# nomos: nomos_builder._add_nomos_ports_info_to_topology
|
||||
vars.GENNET_NWAKU_IMAGE_VALUE: waku_builder._add_waku_ports_info_to_topology,
|
||||
vars.GENNET_NOMOS_IMAGE_VALUE: nomos_builder._add_nomos_ports_info_to_topology
|
||||
}
|
||||
|
||||
def instantiate_services(plan, network_topology, testing):
|
||||
|
@ -70,11 +90,32 @@ def instantiate_services(plan, network_topology, testing):
|
|||
_add_service_info_to_topology(plan, all_services_information, network_topology)
|
||||
|
||||
|
||||
def interconnect_nodes(plan, topology_information, interconnection_batch):
|
||||
# Interconnect them
|
||||
nodes_in_topology = topology_information[vars.GENNET_NODES_KEY]
|
||||
|
||||
for node_id in nodes_in_topology.keys():
|
||||
image = nodes_in_topology[node_id][vars.GENNET_IMAGE_KEY]
|
||||
peers = nodes_in_topology[node_id][vars.GENNET_STATIC_NODES_KEY]
|
||||
create_node_multiaddress = service_multiaddr_dispatcher[image]
|
||||
connect_node_to_peers = service_connect_dispatcher[image]
|
||||
|
||||
for i in range(0, len(peers), interconnection_batch):
|
||||
peer_ids = [create_node_multiaddress(peer, nodes_in_topology[peer])
|
||||
for peer in peers[i:i + interconnection_batch]]
|
||||
|
||||
connect_node_to_peers(plan, nodes_in_topology[node_id][vars.GENNET_NODE_CONTAINER_KEY],
|
||||
node_id, vars.RPC_PORT_ID, peer_ids)
|
||||
|
||||
|
||||
|
||||
def _add_service_info_to_topology(plan, all_services_information, network_topology):
|
||||
for node_id, node_info in network_topology[vars.GENNET_NODES_KEY].items():
|
||||
node_rpc_port_id = vars.RPC_PORT_ID + "_" + node_id
|
||||
|
||||
node_peer_id = waku.get_wakunode_peer_id(plan, node_info[vars.GENNET_NODE_CONTAINER_KEY],
|
||||
image = network_topology[vars.GENNET_NODES_KEY][node_id][vars.GENNET_IMAGE_KEY]
|
||||
peer_id_getter = service_info_dispatcher[image]
|
||||
node_peer_id = peer_id_getter(plan, node_info[vars.GENNET_NODE_CONTAINER_KEY],
|
||||
node_rpc_port_id)
|
||||
|
||||
network_topology[vars.GENNET_NODES_KEY][node_id][vars.PEER_ID_KEY] = node_peer_id
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
# System Imports
|
||||
vars = import_module("github.com/logos-co/wakurtosis/src/system_variables.star")
|
||||
|
||||
|
||||
def prepare_nomos_service(node_name, all_services, config_files, artifact_ids, service_id):
|
||||
prepared_ports = _prepare_nomos_ports_in_service(node_name)
|
||||
prepared_files = _prepare_nomos_config_files_in_service(node_name, artifact_ids)
|
||||
prepared_cmd = _prepare_nomos_cmd_in_service(node_name, config_files)
|
||||
|
||||
add_service_config = ServiceConfig(
|
||||
image=vars.NOMOS_IMAGE,
|
||||
ports=prepared_ports,
|
||||
files=prepared_files,
|
||||
entrypoint=vars.GENERAL_ENTRYPOINT,
|
||||
cmd=prepared_cmd
|
||||
)
|
||||
|
||||
all_services[service_id] = add_service_config
|
||||
|
||||
|
||||
def _prepare_nomos_cmd_in_service(nomos_names, config_files):
|
||||
prepared_cmd = ""
|
||||
for i in range(len(nomos_names)):
|
||||
prepared_cmd += vars.NOMOS_ENTRYPOINT + " "
|
||||
prepared_cmd += vars.NOMOS_CONTAINER_CONFIG_FILE_LOCATION + " "
|
||||
# prepared_cmd += vars.NOMOS_PORT_SHIFT_FLAG + str(i)
|
||||
if i != len(nomos_names) - 1:
|
||||
prepared_cmd += " & "
|
||||
|
||||
return [prepared_cmd]
|
||||
|
||||
|
||||
def _prepare_nomos_ports_in_service(node_names):
|
||||
prepared_ports = {}
|
||||
for i in range(len(node_names)):
|
||||
prepared_ports[vars.RPC_PORT_ID + "_" + node_names[i]] = \
|
||||
PortSpec(number=vars.NOMOS_RPC_PORT_NUMBER + i,
|
||||
transport_protocol=vars.NOMOS_RPC_PORT_PROTOCOL)
|
||||
|
||||
prepared_ports[vars.PROMETHEUS_PORT_ID + "_" + node_names[i]] = \
|
||||
PortSpec(number=vars.PROMETHEUS_PORT_NUMBER + i,
|
||||
transport_protocol=vars.PROMETHEUS_PORT_PROTOCOL)
|
||||
|
||||
prepared_ports[vars.NOMOS_LIBP2P_PORT_ID + "_" + node_names[i]] = \
|
||||
PortSpec(number=vars.NOMOS_LIBP2P_PORT + i,
|
||||
transport_protocol=vars.NOMOS_LIBP2P_PORT_PROTOCOL)
|
||||
|
||||
return prepared_ports
|
||||
|
||||
|
||||
def _prepare_nomos_config_files_in_service(node_names, artifact_ids):
|
||||
prepared_files = {}
|
||||
|
||||
for i in range(len(node_names)):
|
||||
prepared_files[vars.CONTAINER_NODE_CONFIG_FILE_LOCATION + node_names[i]] = artifact_ids[i]
|
||||
|
||||
return prepared_files
|
||||
|
||||
|
||||
def _add_nomos_ports_info_to_topology(network_topology, all_services_information, node_info, node_id):
|
||||
nomos_rpc_port_id = vars.RPC_PORT_ID + "_" + node_id
|
||||
libp2p_port_id = vars.NOMOS_LIBP2P_PORT_ID + "_" + node_id
|
||||
prometheus_port_id = vars.PROMETHEUS_PORT_ID + "_" + node_id
|
||||
|
||||
network_topology[vars.GENNET_NODES_KEY][node_id][vars.PORTS_KEY] = {}
|
||||
_add_nomos_port(network_topology, all_services_information, node_id, node_info, nomos_rpc_port_id)
|
||||
_add_nomos_port(network_topology, all_services_information, node_id, node_info, libp2p_port_id)
|
||||
_add_nomos_port(network_topology, all_services_information, node_id, node_info, prometheus_port_id)
|
||||
|
||||
|
||||
def _add_nomos_port(network_topology, all_services_information, node_id, node_info, port_id):
|
||||
network_topology[vars.GENNET_NODES_KEY][node_id][vars.PORTS_KEY][port_id] = \
|
||||
(all_services_information[node_info[vars.GENNET_NODE_CONTAINER_KEY]].ports[
|
||||
port_id].number,
|
||||
all_services_information[node_info[vars.GENNET_NODE_CONTAINER_KEY]].ports[
|
||||
port_id].transport_protocol)
|
|
@ -3,58 +3,23 @@ vars = import_module("github.com/logos-co/wakurtosis/src/system_variables.star")
|
|||
|
||||
# Module Imports
|
||||
files = import_module(vars.FILE_HELPERS_MODULE)
|
||||
|
||||
|
||||
def get_req(plan, service_name, port_id, endpoint, extract={}):
|
||||
recipe = GetHttpRequestRecipe(
|
||||
service_name=service_name,
|
||||
port_id=port_id,
|
||||
endpoint=endpoint,
|
||||
extract=extract
|
||||
)
|
||||
|
||||
response = plan.wait(recipe=recipe,
|
||||
field="code",
|
||||
assertion="==",
|
||||
target_value=200)
|
||||
|
||||
return response
|
||||
|
||||
|
||||
def post_req(plan, service_name, port_id, endpoint, body, extract={}):
|
||||
recipe = PostHttpRequestRecipe(
|
||||
service_name=service_name,
|
||||
port_id=port_id,
|
||||
endpoint=endpoint,
|
||||
content_type="application/json",
|
||||
body=body,
|
||||
extract=extract
|
||||
)
|
||||
|
||||
response = plan.wait(recipe=recipe,
|
||||
field="code",
|
||||
assertion="==",
|
||||
target_value=200)
|
||||
|
||||
return response
|
||||
call_protocols = import_module(vars.CALL_PROTOCOLS)
|
||||
|
||||
|
||||
def get_nomos_peer_id(plan, service_name, port_id):
|
||||
extract = {"peer_id": '.peer_id'}
|
||||
|
||||
response = get_req(plan, service_name, port_id, vars.NOMOS_NET_INFO_URL, extract)
|
||||
response = call_protocols.send_http_get_req(plan, service_name, port_id, vars.NOMOS_NET_INFO_URL, extract)
|
||||
|
||||
plan.assert(value=response["code"], assertion="==", target_value = 200)
|
||||
|
||||
return response["extract.peer_id"]
|
||||
|
||||
|
||||
def create_nomos_id(nomos_service_information):
|
||||
nomos_service = nomos_service_information["service_info"]
|
||||
|
||||
ip = nomos_service.ip_address
|
||||
port = nomos_service.ports[vars.NOMOS_LIBP2P_PORT_ID].number
|
||||
nomos_node_id = nomos_service_information["peer_id"]
|
||||
def create_node_multiaddress(node_id, node_information):
|
||||
ip = node_information[vars.IP_KEY]
|
||||
port = node_information[vars.PORTS_KEY][vars.NOMOS_LIBP2P_PORT_ID + "_" + node_id][0]
|
||||
nomos_node_id = node_information[vars.PEER_ID_KEY]
|
||||
|
||||
return '"/ip4/' + str(ip) + '/tcp/' + str(port) + '/p2p/' + nomos_node_id + '"'
|
||||
|
||||
|
@ -63,10 +28,11 @@ def _merge_peer_ids(peer_ids):
|
|||
return "[" + ",".join(peer_ids) + "]"
|
||||
|
||||
|
||||
def connect_nomos_to_peers(plan, service_id, port_id, peer_ids):
|
||||
def connect_nomos_to_peers(plan, service_name, node_id, port_id, peer_ids):
|
||||
body = _merge_peer_ids(peer_ids)
|
||||
port_id = port_id + "_" + node_id
|
||||
|
||||
response = post_req(plan, service_id, port_id, vars.NOMOS_NET_CONN_URL, body)
|
||||
response = call_protocols.send_http_post_req(plan, service_name, port_id, vars.NOMOS_NET_CONN_URL, body)
|
||||
|
||||
plan.assert(value=response["code"], assertion="==", target_value = 200)
|
||||
|
||||
|
@ -81,11 +47,18 @@ def make_service_wait(plan,service_id, time):
|
|||
plan.exec(exec_recipe)
|
||||
|
||||
|
||||
def interconnect_nomos_nodes(plan, topology_information, services):
|
||||
def interconnect_nomos_nodes(plan, topology_information, interconnection_batch):
|
||||
# Interconnect them
|
||||
for nomos_service_id in services.keys():
|
||||
peers = topology_information[nomos_service_id]["static_nodes"]
|
||||
nodes_in_topology = topology_information[vars.GENNET_NODES_KEY]
|
||||
|
||||
for node_id in nodes_in_topology.keys():
|
||||
peers = nodes_in_topology[node_id][vars.GENNET_STATIC_NODES_KEY]
|
||||
|
||||
for i in range(0, len(peers), interconnection_batch):
|
||||
peer_ids = [create_node_multiaddress(peer, nodes_in_topology[peer])
|
||||
for peer in peers[i:i + interconnection_batch]]
|
||||
|
||||
connect_nomos_to_peers(plan, nodes_in_topology[node_id][vars.GENNET_NODE_CONTAINER_KEY],
|
||||
node_id, vars.RPC_PORT_ID, peer_ids)
|
||||
|
||||
peer_ids = [create_nomos_id(services[peer]) for peer in peers]
|
||||
|
||||
connect_nomos_to_peers(plan, nomos_service_id, vars.NOMOS_HTTP_PORT_ID, peer_ids)
|
||||
|
|
|
@ -25,13 +25,15 @@ WAKUNODE_CONFIGURATION_FILE_FLAG = "--config-file="
|
|||
WAKUNODE_PORT_SHIFT_FLAG = "--ports-shift="
|
||||
NWAKU_ENTRYPOINT = "/usr/bin/wakunode --rpc-address=0.0.0.0 --metrics-server-address=0.0.0.0 --log-level=TRACE"
|
||||
GOWAKU_ENTRYPOINT = "/usr/bin/waku --rpc-address=0.0.0.0 --metrics-server-address=0.0.0.0"
|
||||
NOMOS_ENTRYPOINT = ["/usr/bin/nomos-node"]
|
||||
NOMOS_ENTRYPOINT = "/usr/bin/nomos-node"
|
||||
NOMOS_PORT_SHIFT_FLAG = "--ports-shift="
|
||||
NOMOS_CONTAINER_CONFIG_FILE_LOCATION = '/etc/nomos/config.yml'
|
||||
|
||||
# Nomos Configuration
|
||||
NOMOS_IMAGE = "nomos"
|
||||
NOMOS_HTTP_PORT_ID = "rpc"
|
||||
NOMOS_HTTP_PORT = 8080
|
||||
NOMOS_RPC_PORT_PROTOCOL = "TCP"
|
||||
NOMOS_RPC_PORT_NUMBER = 8080
|
||||
NOMOS_LIBP2P_PORT_PROTOCOL = "TCP"
|
||||
NOMOS_LIBP2P_PORT_ID = "libp2p"
|
||||
NOMOS_LIBP2P_PORT = 3000
|
||||
NOMOS_SETUP_WAIT_TIME = "5"
|
||||
|
@ -79,6 +81,7 @@ GENNET_NODE_CONTAINER_KEY = "container_id"
|
|||
GENNET_STATIC_NODES_KEY = "static_nodes"
|
||||
GENNET_GOWAKU_IMAGE_VALUE = "go-waku"
|
||||
GENNET_NWAKU_IMAGE_VALUE = "nim-waku"
|
||||
GENNET_NOMOS_IMAGE_VALUE = "nomos"
|
||||
|
||||
PEER_ID_KEY = "peer_id"
|
||||
IP_KEY = "ip_address"
|
||||
|
@ -107,6 +110,7 @@ NODE_BUILDERS_MODULE = "github.com/logos-co/wakurtosis/src/node_builders/node_bu
|
|||
WAKU_BUILDER_MODULE = "github.com/logos-co/wakurtosis/src/node_builders/types/waku_builder.star"
|
||||
NWAKU_BUILDER_MODULE = "github.com/logos-co/wakurtosis/src/node_builders/types/nwaku_builder.star"
|
||||
GOWAKU_BUILDER_MODULE = "github.com/logos-co/wakurtosis/src/node_builders/types/gowaku_builder.star"
|
||||
NOMOS_BUILDER_MODULE = "github.com/logos-co/wakurtosis/src/node_builders/types/nomos_builder.star"
|
||||
PROMETHEUS_MODULE = "github.com/logos-co/wakurtosis/src/monitoring/prometheus.star"
|
||||
GRAFANA_MODULE = "github.com/logos-co/wakurtosis/src/monitoring/grafana.star"
|
||||
ARGUMENT_PARSER_MODULE = "github.com/logos-co/wakurtosis/src/arguments_parser.star"
|
||||
|
|
Loading…
Reference in New Issue