2560 - Some minor tweaks to network_simulator_demo.ipynb and networks.py after looking through some bugs. Sys_log should print

This commit is contained in:
Charlie Crane
2024-05-17 16:55:41 +01:00
parent d80eb15fa2
commit dc8105e8d6
2 changed files with 18 additions and 8 deletions

View File

@@ -66,7 +66,7 @@
},
"outputs": [],
"source": [
"from primaite.simulator.network.networks import arcd_uc2_network"
"from primaite.simulator.network.networks import network_simulator_demo_example"
]
},
{
@@ -78,7 +78,7 @@
},
"outputs": [],
"source": [
"network = arcd_uc2_network()"
"network = network_simulator_demo_example()"
]
},
{
@@ -188,7 +188,7 @@
"id": "15",
"metadata": {},
"source": [
"Calling `router.router_table.show()` displays the static routes the Router provides."
"Calling `router.router_table.show()` displays the static routes the Router provides. "
]
},
{
@@ -222,7 +222,7 @@
},
"outputs": [],
"source": [
"network.get_node_by_hostname(\"router_1\").sys_log.show(last_n=10)"
"network.get_node_by_hostname(\"router_1\").sys_log.show()"
]
},
{
@@ -344,7 +344,7 @@
},
"outputs": [],
"source": [
"network.get_node_by_hostname(\"security_suite\").sys_log.show()"
"network.get_node_by_hostname(\"security_suite\").sys_log.show(last_n=25)"
]
},
{
@@ -398,7 +398,7 @@
},
"outputs": [],
"source": [
"network.get_node_by_hostname(\"client_1\").sys_log.show(15)"
"network.get_node_by_hostname(\"client_1\").sys_log.show(last_n=15)"
]
},
{
@@ -660,7 +660,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.10.11"
}
},
"nbformat": 4,

View File

@@ -287,6 +287,16 @@ def arcd_uc2_network() -> Network:
return network
def network_simulator_demo_example() -> Network:
"""Returns a lightly modified version of the ARCD UC2 Network."""
network = arcd_uc2_network()
network.get_node_by_hostname("router_1").route_table.add_route(
address="192.168.10.0", subnet_mask="255.255.255.0", next_hop_ip_address="192.168.1.2"
)
return network
def _get_example_network(path: str) -> Network:
try:
with open(path, "r") as file:
@@ -308,7 +318,7 @@ def client_server_p2p_network_example() -> Network:
def basic_lan_network_example() -> Network:
"""Get the basic LAN example network."""
path = PRIMAITE_PATHS.user_config_path / "example_config" / "basic_network_network_example.yaml"
path = PRIMAITE_PATHS.user_config_path / "example_config" / "basic_lan_network_example.yaml"
return _get_example_network(path)