From 39ec55c7b69c7b6d688237fac802aeb572e2778a Mon Sep 17 00:00:00 2001 From: Marek Wolan Date: Mon, 15 Apr 2024 13:12:51 +0100 Subject: [PATCH] #2459 strip notebook outputs to appease pre-commit --- .../create-simulation_demo.ipynb | 3 +- .../network_simulator_demo.ipynb | 122 +++++++++--------- 2 files changed, 62 insertions(+), 63 deletions(-) diff --git a/src/primaite/simulator/_package_data/create-simulation_demo.ipynb b/src/primaite/simulator/_package_data/create-simulation_demo.ipynb index d9742b50..f403176a 100644 --- a/src/primaite/simulator/_package_data/create-simulation_demo.ipynb +++ b/src/primaite/simulator/_package_data/create-simulation_demo.ipynb @@ -258,8 +258,7 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" - }, - "orig_nbformat": 4 + } }, "nbformat": 4, "nbformat_minor": 2 diff --git a/src/primaite/simulator/_package_data/network_simulator_demo.ipynb b/src/primaite/simulator/_package_data/network_simulator_demo.ipynb index b537f54b..1da58409 100644 --- a/src/primaite/simulator/_package_data/network_simulator_demo.ipynb +++ b/src/primaite/simulator/_package_data/network_simulator_demo.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "03b2013a-b7d1-47ee-b08c-8dab83833720", + "id": "0", "metadata": {}, "source": [ "# PrimAITE Router Simulation Demo\n", @@ -12,7 +12,7 @@ }, { "cell_type": "raw", - "id": "c8bb5698-e746-4e90-9c2f-efe962acdfa0", + "id": "1", "metadata": {}, "source": [ " +------------+\n", @@ -48,7 +48,7 @@ }, { "cell_type": "markdown", - "id": "415d487c-6457-497d-85d6-99439b3541e7", + "id": "2", "metadata": {}, "source": [ "## The Network\n", @@ -60,7 +60,7 @@ { "cell_type": "code", "execution_count": null, - "id": "de57ac8c-5b28-4847-a759-2ceaf5593329", + "id": "3", "metadata": { "tags": [] }, @@ -72,7 +72,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a1e2e4df-67c0-4584-ab27-47e2c7c7fcd2", + "id": "4", "metadata": { "tags": [] }, @@ -83,7 +83,7 @@ }, { "cell_type": "markdown", - "id": "fb052c56-e9ca-4093-9115-d0c440b5ff53", + "id": "5", "metadata": {}, "source": [ "Most of the Network components have a `.show()` function that prints a table of information about that object. We can view the Nodes and Links on the Network by calling `network.show()`." @@ -92,7 +92,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cc199741-ef2e-47f5-b2f0-e20049ccf40f", + "id": "6", "metadata": { "tags": [] }, @@ -103,7 +103,7 @@ }, { "cell_type": "markdown", - "id": "76d2b7e9-280b-4741-a8b3-a84bed219fac", + "id": "7", "metadata": { "tags": [] }, @@ -115,7 +115,7 @@ }, { "cell_type": "markdown", - "id": "84113002-843e-4cab-b899-667b50f25f6b", + "id": "8", "metadata": {}, "source": [ "### Router Nodes\n", @@ -125,7 +125,7 @@ }, { "cell_type": "markdown", - "id": "bf63a178-eee5-4669-bf64-13aea7ecf6cb", + "id": "9", "metadata": {}, "source": [ "Calling `router.show()` displays the Ethernet interfaces on the Router. If you need a table in markdown format, pass `markdown=True`." @@ -134,7 +134,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e76d1854-961e-438c-b40f-77fd9c3abe38", + "id": "10", "metadata": { "tags": [] }, @@ -145,7 +145,7 @@ }, { "cell_type": "markdown", - "id": "e000540c-687c-4254-870c-1d814603bdbf", + "id": "11", "metadata": {}, "source": [ "Calling `router.arp.show()` displays the Router ARP Cache." @@ -154,7 +154,7 @@ { "cell_type": "code", "execution_count": null, - "id": "92de8b42-92d7-4934-9c12-50bf724c9eb2", + "id": "12", "metadata": { "tags": [] }, @@ -165,7 +165,7 @@ }, { "cell_type": "markdown", - "id": "a9ff7ee8-9482-44de-9039-b684866bdc82", + "id": "13", "metadata": {}, "source": [ "Calling `router.acl.show()` displays the Access Control List." @@ -174,7 +174,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5922282a-d22b-4e55-9176-f3f3654c849f", + "id": "14", "metadata": { "tags": [] }, @@ -185,7 +185,7 @@ }, { "cell_type": "markdown", - "id": "71c87884-f793-4c9f-b004-5b0df86cf585", + "id": "15", "metadata": {}, "source": [ "Calling `router.router_table.show()` displays the static routes the Router provides." @@ -194,7 +194,7 @@ { "cell_type": "code", "execution_count": null, - "id": "327203be-f475-4727-82a1-e992d3b70ed8", + "id": "16", "metadata": { "tags": [] }, @@ -205,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "eef561a8-3d39-4c8b-bbc8-e8b10b8ed25f", + "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=`." @@ -214,7 +214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3d0aa004-b10c-445f-aaab-340e0e716c74", + "id": "18", "metadata": { "tags": [] }, @@ -225,7 +225,7 @@ }, { "cell_type": "markdown", - "id": "25630c90-c54e-4b5d-8bf4-ad1b0722e126", + "id": "19", "metadata": {}, "source": [ "### Switch Nodes\n", @@ -235,7 +235,7 @@ }, { "cell_type": "markdown", - "id": "4879394d-2981-40de-a229-e19b09a34e6e", + "id": "20", "metadata": {}, "source": [ "Calling `switch.show()` displays the Switch orts on the Switch." @@ -244,7 +244,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e7fd439b-5442-4e9d-9e7d-86dacb77f458", + "id": "21", "metadata": { "tags": [] }, @@ -255,7 +255,7 @@ }, { "cell_type": "markdown", - "id": "beb8dbd6-7250-4ac9-9fa2-d2a9c0e5fd19", + "id": "22", "metadata": { "tags": [] }, @@ -266,7 +266,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d06e1310-4a77-4315-a59f-cb1b49ca2352", + "id": "23", "metadata": { "tags": [] }, @@ -277,7 +277,7 @@ }, { "cell_type": "markdown", - "id": "fda75ac3-8123-4234-8f36-86547891d8df", + "id": "24", "metadata": {}, "source": [ "Calling `switch.sys_log.show()` displays the Switch system log. By default, only the last 10 log entries are displayed, this can be changed by passing `last_n=`." @@ -286,7 +286,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a0d984b7-a7c1-4bbd-aa5a-9d3caecb08dc", + "id": "25", "metadata": { "tags": [] }, @@ -297,7 +297,7 @@ }, { "cell_type": "markdown", - "id": "2f1d99ad-db4f-4baf-8a35-e1d95f269586", + "id": "26", "metadata": {}, "source": [ "### Computer/Server Nodes\n", @@ -307,7 +307,7 @@ }, { "cell_type": "markdown", - "id": "c9e2251a-1b47-46e5-840f-7fec3e39c5aa", + "id": "27", "metadata": { "tags": [] }, @@ -318,7 +318,7 @@ { "cell_type": "code", "execution_count": null, - "id": "656c37f6-b145-42af-9714-8d2886d0eff8", + "id": "28", "metadata": { "tags": [] }, @@ -329,7 +329,7 @@ }, { "cell_type": "markdown", - "id": "f1097a49-a3da-4d79-a06d-ae8af452918f", + "id": "29", "metadata": {}, "source": [ "Calling `computer.arp.show()` displays the Computer/Server ARP Cache." @@ -338,7 +338,7 @@ { "cell_type": "code", "execution_count": null, - "id": "66b267d6-2308-486a-b9aa-cb8d3bcf0753", + "id": "30", "metadata": { "tags": [] }, @@ -349,7 +349,7 @@ }, { "cell_type": "markdown", - "id": "0d1fcad8-5b1a-4d8b-a49f-aa54a95fcaf0", + "id": "31", "metadata": {}, "source": [ "Calling `switch.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=`." @@ -358,7 +358,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1b5debe8-ef1b-445d-8fa9-6a45568f21f3", + "id": "32", "metadata": { "tags": [] }, @@ -369,7 +369,7 @@ }, { "cell_type": "markdown", - "id": "fcfa1773-798c-4ada-9318-c3ad928217da", + "id": "33", "metadata": {}, "source": [ "## Basic Network Comms Check\n", @@ -380,7 +380,7 @@ { "cell_type": "code", "execution_count": null, - "id": "495b7de4-b6ce-41a6-9114-f74752ab4491", + "id": "34", "metadata": { "tags": [] }, @@ -391,7 +391,7 @@ }, { "cell_type": "markdown", - "id": "3e13922a-217f-4f4e-99b6-57a07613cade", + "id": "35", "metadata": {}, "source": [ "We'll first ping client_1's default gateway." @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a38abb71-994e-49e8-8f51-e9a550e95b99", + "id": "36", "metadata": { "tags": [] }, @@ -412,7 +412,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8388e1e9-30e3-4534-8e5a-c6e9144149d2", + "id": "37", "metadata": { "tags": [] }, @@ -423,7 +423,7 @@ }, { "cell_type": "markdown", - "id": "02c76d5c-d954-49db-912d-cb9c52f46375", + "id": "38", "metadata": {}, "source": [ "Next, we'll ping the interface of the 192.168.1.0/24 Network on the Router (port 1)." @@ -432,7 +432,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ff8e976a-c16b-470c-8923-325713a30d6c", + "id": "39", "metadata": { "tags": [] }, @@ -443,7 +443,7 @@ }, { "cell_type": "markdown", - "id": "80280404-a5ab-452f-8a02-771a0d7496b1", + "id": "40", "metadata": {}, "source": [ "And finally, we'll ping the web server." @@ -452,7 +452,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c4163f8d-6a72-410c-9f5c-4f881b7de45e", + "id": "41", "metadata": { "tags": [] }, @@ -463,7 +463,7 @@ }, { "cell_type": "markdown", - "id": "1194c045-ba77-4427-be30-ed7b5b224850", + "id": "42", "metadata": {}, "source": [ "To confirm that the ping was received and processed by the web_server, we can view the sys log" @@ -472,7 +472,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e79a523a-5780-45b6-8798-c434e0e522bd", + "id": "43", "metadata": { "tags": [] }, @@ -483,7 +483,7 @@ }, { "cell_type": "markdown", - "id": "5928f6dd-1006-45e3-99f3-8f311a875faa", + "id": "44", "metadata": {}, "source": [ "## Advanced Network Usage\n", @@ -493,7 +493,7 @@ }, { "cell_type": "markdown", - "id": "5e023ef3-7d18-4006-96ee-042a06a481fc", + "id": "45", "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..." @@ -502,7 +502,7 @@ { "cell_type": "code", "execution_count": null, - "id": "603cf913-e261-49da-a7dd-85e1bb6dec56", + "id": "46", "metadata": { "tags": [] }, @@ -513,7 +513,7 @@ }, { "cell_type": "markdown", - "id": "5cf962a4-20e6-44ae-9748-7fc5267ae111", + "id": "47", "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:" @@ -522,7 +522,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e047de00-3de4-4823-b26a-2c8d64c7a663", + "id": "48", "metadata": { "tags": [] }, @@ -533,7 +533,7 @@ }, { "cell_type": "markdown", - "id": "bdc4741d-6e3e-4aec-a69c-c2e9653bd02c", + "id": "49", "metadata": {}, "source": [ "Now we'll add an ACL to block ICMP from 192.168.10.22" @@ -542,7 +542,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6db355ae-b99a-441b-a2c4-4ffe78f46bff", + "id": "50", "metadata": { "tags": [] }, @@ -562,7 +562,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a345e000-8842-4827-af96-adc0fbe390fb", + "id": "51", "metadata": { "tags": [] }, @@ -573,7 +573,7 @@ }, { "cell_type": "markdown", - "id": "3a5bfd9f-04cb-493e-a86c-cd268563a262", + "id": "52", "metadata": {}, "source": [ "Now we attempt (and fail) to ping the web server" @@ -582,7 +582,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a4f4ff31-590f-40fb-b13d-efaa8c2720b6", + "id": "53", "metadata": { "tags": [] }, @@ -593,7 +593,7 @@ }, { "cell_type": "markdown", - "id": "83e56497-097b-45cb-964e-b15c72547b38", + "id": "54", "metadata": {}, "source": [ "We can check that the ping was actually sent by client_2 by viewing the sys log" @@ -602,7 +602,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f62b8a4e-fd3b-4059-b108-3d4a0b18f2a0", + "id": "55", "metadata": { "tags": [] }, @@ -613,7 +613,7 @@ }, { "cell_type": "markdown", - "id": "c7040311-a879-4620-86a0-55d0774156e5", + "id": "56", "metadata": {}, "source": [ "We can check the router sys log to see why the traffic was blocked" @@ -622,7 +622,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7e53d776-99da-4d2c-a2a7-bd7ce27bff4c", + "id": "57", "metadata": { "tags": [] }, @@ -633,7 +633,7 @@ }, { "cell_type": "markdown", - "id": "aba0bc7d-da57-477b-b34a-3688b5aab2c6", + "id": "58", "metadata": {}, "source": [ "Now a final check to ensure that client_1 can still ping the web_server." @@ -642,7 +642,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d542734b-7582-4af7-8254-bda3de50d091", + "id": "59", "metadata": { "tags": [] }, @@ -654,7 +654,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d78e9fe3-02c6-4792-944f-5622e26e0412", + "id": "60", "metadata": { "tags": [] },