Fixed errors with new image

This commit is contained in:
Alberto Soutullo
2023-10-30 19:07:13 +01:00
parent a166eaed07
commit 4a4d4efc43
4 changed files with 16 additions and 13 deletions

View File

@@ -17,13 +17,13 @@ def _load_topics(node_info, nodes, node, tomls_folder):
with open(tomls_folder + node_info["node_config"], mode='rb') as read_file:
toml_config = tomllib.load(read_file)
if node_info["image"] == vars.G_NWAKU_IMAGE_NAME:
topics = list(toml_config["topics"].split(" "))
topics = toml_config["pubsub-topic"]
elif node_info["image"] == vars.G_GOWAKU_IMAGE_NAME:
topics = toml_config["topics"]
topics = toml_config["pubsub-topic"]
else:
raise ValueError("Unknown image type")
# Load topics into topology for easier access
nodes[node]["topics"] = topics
nodes[node]["pubsub-topic"] = topics
def load_topics_into_topology(topology, tomls_folder):

View File

@@ -312,12 +312,15 @@ def generate_subnets(G, num_subnets):
# Generate per node toml configs
def generate_toml(traits_dir, topics, traits_list):
topics, node_type, tomls = get_random_sublist(topics), traits_list[0], ""
if node_type == nodeType.GOWAKU: # comma separated list of quoted topics
topic_str = ", ".join(f"\"{t}\"" for t in topics)
topic_str = f"[{topic_str}]"
else: # space separated topics
topic_str = " ".join(topics)
topic_str = f"\"{topic_str}\""
# if node_type == nodeType.GOWAKU: # comma separated list of quoted topics
# topic_str = ", ".join(f"\"{t}\"" for t in topics)
# topic_str = f"[{topic_str}]"
# else: # space separated topics
# topic_str = " ".join(topics)
# topic_str = f"\"{topic_str}\""
topic_str = " ".join(f"\"/waku/2/{t}\"" for t in topics)
topic_str = f"[ {topic_str} ]"
for trait in traits_list[1:]: # skip the first trait as it is docker/node selector.
toml = f'#{trait}\n'
@@ -328,7 +331,7 @@ def generate_toml(traits_dir, topics, traits_list):
strlines = [l.decode("utf-8").strip() for l in f if not len(l.split()) == 0]
toml += ''.join([f'{l}\n' for l in strlines if not l.startswith('#')])
tomls += toml + '\n'
return f"{tomls}#topics\ntopics = {topic_str}\n"
return f"{tomls}#topics\npubsub-topic = {topic_str}\n"
# Convert a dict to pair of arrays

View File

@@ -1,5 +1,5 @@
# IMAGES
NWAKU_IMAGE = "statusteam/nim-waku:nwaku-trace3"
NWAKU_IMAGE = "wakuorg/nwaku:wakunode_dst"
GOWAKU_IMAGE = "gowaku"
NOMOS_IMAGE = "nomos-node"

View File

@@ -43,9 +43,9 @@ def _load_topics(node_info, nodes, node):
with open("tomls/" + node_info["node_config"], mode='rb') as read_file:
toml_config = tomllib.load(read_file)
if node_info["image"] == "nim-waku":
topics = list(toml_config["topics"].split(" "))
topics = toml_config["pubsub-topic"]
elif node_info["image"] == "go-waku":
topics = toml_config["topics"]
topics = toml_config["pubsub-topic"]
else:
raise ValueError("Unknown image type")
# Load topics into topology for easier access