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:
@@ -66,7 +66,7 @@
|
|||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"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": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"network = arcd_uc2_network()"
|
"network = network_simulator_demo_example()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -188,7 +188,7 @@
|
|||||||
"id": "15",
|
"id": "15",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"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": [],
|
"outputs": [],
|
||||||
"source": [
|
"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": [],
|
"outputs": [],
|
||||||
"source": [
|
"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": [],
|
"outputs": [],
|
||||||
"source": [
|
"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",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.12"
|
"version": "3.10.11"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
@@ -287,6 +287,16 @@ def arcd_uc2_network() -> Network:
|
|||||||
return 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:
|
def _get_example_network(path: str) -> Network:
|
||||||
try:
|
try:
|
||||||
with open(path, "r") as file:
|
with open(path, "r") as file:
|
||||||
@@ -308,7 +318,7 @@ def client_server_p2p_network_example() -> Network:
|
|||||||
|
|
||||||
def basic_lan_network_example() -> Network:
|
def basic_lan_network_example() -> Network:
|
||||||
"""Get the basic LAN 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)
|
return _get_example_network(path)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user