#2457 - Commit before switching branches to review
This commit is contained in:
@@ -368,6 +368,7 @@ simulation:
|
|||||||
endpoint_a_port: 1
|
endpoint_a_port: 1
|
||||||
endpoint_b_hostname: switch_1
|
endpoint_b_hostname: switch_1
|
||||||
endpoint_b_port: 1
|
endpoint_b_port: 1
|
||||||
|
bandwidth: 200
|
||||||
- endpoint_a_hostname: pc_2
|
- endpoint_a_hostname: pc_2
|
||||||
endpoint_a_port: 1
|
endpoint_a_port: 1
|
||||||
endpoint_b_hostname: switch_1
|
endpoint_b_hostname: switch_1
|
||||||
|
|||||||
@@ -406,9 +406,15 @@ class PrimaiteGame:
|
|||||||
new_node.shut_down_duration = int(node_cfg.get("shut_down_duration", 3))
|
new_node.shut_down_duration = int(node_cfg.get("shut_down_duration", 3))
|
||||||
|
|
||||||
# 2. create links between nodes
|
# 2. create links between nodes
|
||||||
|
# TODO: Pull from link_cfg the 'bandwidth' of that link
|
||||||
for link_cfg in links_cfg:
|
for link_cfg in links_cfg:
|
||||||
node_a = net.get_node_by_hostname(link_cfg["endpoint_a_hostname"])
|
node_a = net.get_node_by_hostname(link_cfg["endpoint_a_hostname"])
|
||||||
node_b = net.get_node_by_hostname(link_cfg["endpoint_b_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
|
||||||
|
|
||||||
if isinstance(node_a, Switch):
|
if isinstance(node_a, Switch):
|
||||||
endpoint_a = node_a.network_interface[link_cfg["endpoint_a_port"]]
|
endpoint_a = node_a.network_interface[link_cfg["endpoint_a_port"]]
|
||||||
@@ -418,7 +424,7 @@ class PrimaiteGame:
|
|||||||
endpoint_b = node_b.network_interface[link_cfg["endpoint_b_port"]]
|
endpoint_b = node_b.network_interface[link_cfg["endpoint_b_port"]]
|
||||||
else:
|
else:
|
||||||
endpoint_b = node_b.network_interface[link_cfg["endpoint_b_port"]]
|
endpoint_b = node_b.network_interface[link_cfg["endpoint_b_port"]]
|
||||||
net.connect(endpoint_a=endpoint_a, endpoint_b=endpoint_b)
|
net.connect(endpoint_a=endpoint_a, endpoint_b=endpoint_b, bandwidth=bandwidth)
|
||||||
|
|
||||||
# 3. create agents
|
# 3. create agents
|
||||||
agents_cfg = cfg.get("agents", [])
|
agents_cfg = cfg.get("agents", [])
|
||||||
|
|||||||
@@ -315,4 +315,5 @@ def basic_lan_network_example() -> Network:
|
|||||||
def multi_lan_internet_network_example() -> Network:
|
def multi_lan_internet_network_example() -> Network:
|
||||||
"""Get Multi-LAN with Internet example network."""
|
"""Get Multi-LAN with Internet example network."""
|
||||||
path = PRIMAITE_PATHS.user_config_path / "example_config" / "multi_lan_internet_network_example.yaml"
|
path = PRIMAITE_PATHS.user_config_path / "example_config" / "multi_lan_internet_network_example.yaml"
|
||||||
|
print(path)
|
||||||
return _get_example_network(path)
|
return _get_example_network(path)
|
||||||
|
|||||||
Reference in New Issue
Block a user