#2457 - Initial commit removing the hardcoding of bandwidth values within links. Now pull it from configuration files, defaulting to 100 if not implemented

This commit is contained in:
Charlie Crane
2024-05-13 14:42:15 +01:00
parent 4cd15a39aa
commit 71684dc5f0
6 changed files with 12 additions and 13 deletions

View File

@@ -406,15 +406,10 @@ class PrimaiteGame:
new_node.shut_down_duration = int(node_cfg.get("shut_down_duration", 3))
# 2. create links between nodes
# TODO: Pull from link_cfg the 'bandwidth' of that link
for link_cfg in links_cfg:
node_a = net.get_node_by_hostname(link_cfg["endpoint_a_hostname"])
node_b = net.get_node_by_hostname(link_cfg["endpoint_b_hostname"])
print(link_cfg)
try:
bandwidth = link_cfg["bandwidth"]
except Exception:
bandwidth = 100
bandwidth = link_cfg.get("bandwidth", 100) # default value if not configured
if isinstance(node_a, Switch):
endpoint_a = node_a.network_interface[link_cfg["endpoint_a_port"]]