Merged PR 379: #2560 - Network_simulator_demo.ipynb cell fixes
## Summary
Some minor changes to the network_simulator_demo jupyter notebook so that all cells run.
I've updated the notebook to use a **very lightly** modified version of the ARCD UC2 network that it has been using.
_I've added a single route into the router_1 route table so that `network.get_node_by_hostname("router_1").route_table.show()` returns something visible. I didn't want to have this within the 'normal' uc2 network. Don't @ me._

Corrected a path typo in `basic_lan_network_example()` so it correctly loads that network config.
## Test process
I've not broken any existing tests, and the notebook now runs with fully populated cells.
## Checklist
- [X] PR is linked to a **work item**
- [X] **acceptance criteria** of linked ticket are met
- [X] performed **self-review** of the code
- [X] written **tests** for any new functionality added with this PR
- [X] updated the **documentation** if this PR changes or adds functionality
- [X] written/updated **design docs** if this PR implements new functionality
- [X] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [X] attended to any **TO-DOs** left in the code
Related work items: #2560
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
"source": [
|
||||
"# PrimAITE Router Simulation Demo\n",
|
||||
"\n",
|
||||
"This demo uses the ARCD Use Case 2 Network (seen below) to demonstrate the capabilities of the Network simulator in PrimAITE."
|
||||
"This demo uses a modified version of the ARCD Use Case 2 Network (seen below) to demonstrate the capabilities of the Network simulator in PrimAITE."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -56,7 +56,7 @@
|
||||
"## The Network\n",
|
||||
"First let's create our network. The network comes 'pre-packaged' with PrimAITE in the `primaite.simulator.network.networks` module.\n",
|
||||
"\n",
|
||||
"> ℹ️ You'll see a bunch of logs associated with parts of the Network that aern't an 'electronic' device on the Network and thus don't have a stsrem to log to. Soon these logs are going to be pushed to a Network Logger so we're not clogging up the PrimAITE application logs."
|
||||
"> ℹ️ You'll see a bunch of logs associated with parts of the Network that aren't an 'electronic' device on the Network and thus don't have a stream to log to. Soon these logs are going to be pushed to a Network Logger so we're not clogging up the PrimAITE application logs."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -68,7 +68,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from primaite.simulator.network.networks import arcd_uc2_network"
|
||||
"from primaite.simulator.network.networks import network_simulator_demo_example"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -80,7 +80,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"network = arcd_uc2_network()"
|
||||
"network = network_simulator_demo_example()"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -190,7 +190,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. "
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -210,7 +210,9 @@
|
||||
"id": "17",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Calling `router.sys_log.show()` displays the Router system log. By default, only the last 10 log entries are displayed, this can be changed by passing `last_n=<number of log entries>`."
|
||||
"Calling `router.sys_log.show()` displays the Router system log. By default, only the last 10 log entries are displayed, this can be changed by passing `last_n=<number of log entries>`.\n",
|
||||
"\n",
|
||||
"NB: For `sys_log.show()` to work correctly log files need to be created with a sys_log level of INFO or below."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -222,7 +224,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()"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -232,7 +234,7 @@
|
||||
"source": [
|
||||
"### Switch Nodes\n",
|
||||
"\n",
|
||||
"Next we'll inspect the Switch node and some of it's core services."
|
||||
"Next we'll inspect the Switch node and some of its core services."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -332,7 +334,7 @@
|
||||
"id": "29",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Calling `computer.sys_log.show()` displays the Computer/Server system log. By default, only the last 10 log entries are displayed, this can be changed by passing `last_n=<number of log entries>`."
|
||||
"Calling `computer.sys_log.show()` displays the Computer/Server system log. By default, only the last 10 log entries are displayed; this can be changed by passing `last_n=<number of log entries>`."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -344,7 +346,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 +400,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)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -476,7 +478,7 @@
|
||||
"id": "43",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's attempt to prevent client_2 from being able to ping the web server. First, we'll confirm that it can ping the server first..."
|
||||
"Let's attempt to prevent client_2 from being able to ping the web server. First, we'll confirm that it can ping the server..."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -496,7 +498,7 @@
|
||||
"id": "45",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"If we look at the client_2 sys log we can see that the four ICMP echo requests were sent and four ICMP each replies were received:"
|
||||
"If we look at the client_2 sys log we can see that the four ICMP echo requests were sent and four ICMP each replies were received."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -516,7 +518,7 @@
|
||||
"id": "47",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now we'll add an ACL to block ICMP from 192.168.10.22"
|
||||
"Now we'll add an ACL to block ICMP from 192.168.10.22."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -556,7 +558,7 @@
|
||||
"id": "50",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now we attempt (and fail) to ping the web server"
|
||||
"Now we attempt (and fail) to ping the web server."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -576,7 +578,7 @@
|
||||
"id": "52",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"We can check that the ping was actually sent by client_2 by viewing the sys log"
|
||||
"We can check that the ping was actually sent by client_2 by viewing the sys log."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -596,7 +598,7 @@
|
||||
"id": "54",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"We can check the router sys log to see why the traffic was blocked"
|
||||
"We can check the router sys log to see why the traffic was blocked."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user