Skip to content

eytkhere/NetworkLearning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

NetworkLearning

Assignments covering EVC, VLAN, Layer 2, and Layer 3 networking from the basics

Assignment 1: Creating a Basic Network Device Class

Now that you’re starting with networking concepts in Python, let’s build a foundational class for network devices. Goal

You will create a NetworkDevice class that represents a basic network device with essential attributes and methods.

📌 Requirements

1️⃣ NetworkDevice Class

Create a class NetworkDevice with the following attributes and methods:

__init__(self, name: str, ip_address: str, device_type: str):

    Initializes a network device with a name, IP address, and type (e.g., switch, router).

get_info(self) -> str:

    Returns a string representation of the device's details.

ping(self, target_ip: str) -> str:

    Simulates a ping to another device and returns a success or failure message.

Assignment 2: Implementing Switch and Router Subclasses

Now that you have a base network device class, it’s time to extend it with specific functionality for switches and routers. Goal

You will create Switch and Router subclasses that inherit from NetworkDevice and implement unique behaviors.

📌 Requirements

1️⃣ Switch and Router Classes

Create a Switch class that:

    Inherits from NetworkDevice.

    Has a vlans attribute to store VLANs.

    Implements a add_vlan(vlan_id: int) method to manage VLANs.

Create a Router class that:

    Inherits from NetworkDevice.

    Has a routes attribute to store static routes.

    Implements an add_route(destination: str, next_hop: str) method for static routing.

Assignment 3: Implementing VLAN Management

VLANs are essential in networking. Let’s create a Python class to manage them dynamically. Goal

You will build a VLANManager class to create, delete, and list VLANs on a network switch.

📌 Requirements

1️⃣ VLANManager Class

__init__(self):

    Initializes an empty dictionary to store VLANs.

create_vlan(self, vlan_id: int, name: str):

    Adds a VLAN with an ID and name.

delete_vlan(self, vlan_id: int):

    Removes a VLAN by ID.

list_vlans(self) -> list:

    Returns a list of all VLANs.

Assignment 4: Simulating Spanning Tree Protocol (STP)

Switching loops can cause network failures. Let’s simulate how STP prevents them. Goal

You will create an STPSimulator class that determines the root bridge and blocks redundant links.

📌 Requirements

1️⃣ STPSimulator Class

__init__(self, switches: dict):

    Accepts a dictionary of switches with bridge priorities.

determine_root_bridge(self) -> str:

    Determines the switch with the lowest priority as the root bridge.

block_redundant_links(self) -> list:

    Simulates blocking of redundant links to prevent loops.

Assignment 5: Simulating EtherChannel Configuration

Link aggregation increases bandwidth and redundancy. Let’s simulate EtherChannel in Python. Goal

You will build an EtherChannel class that aggregates multiple links into a single logical connection.

📌 Requirements

1️⃣ EtherChannel Class

__init__(self, links: list):

    Accepts a list of link bandwidths.

add_link(self, bandwidth: int):

    Adds a new link to the channel.

get_total_bandwidth(self) -> int:

    Returns the total aggregated bandwidth.

Assignment 6: Simulating a Routing Table

Routers use routing tables to determine the best path. Let’s simulate this in Python. Goal

You will build a RoutingTable class that stores and retrieves static routes.

📌 Requirements

1️⃣ RoutingTable Class

__init__(self):

    Initializes an empty dictionary to store routes.

add_route(self, destination: str, next_hop: str):

    Adds a static route.

lookup_route(self, destination: str) -> str:

    Returns the next hop for a given destination.

About

Assignments covering EVC, VLAN, Layer 2, and Layer 3 networking from the basics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published