Programming Assignment 3: Network Layer SDN Forwarding Simulation

Assigned Friday October 28th

Due Monday November 14th @11:59 PM

GitHub Repo

You will use the same GitHub repo from PA1, and PA2. All of your files for this assignment should go inside a /PA3 folder

Overview

In this assignment, you will simulate a network of routers that use SDN-based routing for their routing decisions. Routers will do actions (forward, drop, modify) packets based on a set of rules managed by a SDN. For this assignment you will be simulating a network with 4 routers. Each router has a list of machine IP addresses that are directly connected to it, a set of links to other routers, and a set of rules defined by a SDN.
For example, Router B has two links (Link to A, and Link to B) and has the subnet 10.2.2.0/24 connected to it. Packets that arrive to router B that have an destination IP address for one those two machines can be directly delivered.

Packets

You will need to implement a packet class similarly to PA2. Each packet that gets sent into this network will have (AT LEAST) the following information:    Class Packet {} src_ip_address is the source IP address for the packet. dst_ip_addressis the destination IP address for the packet. src_tl_port and dst_ip_address are the source transport layer port, and destination transport layer ports of the packet, respectively. The protcol represents the protocol of the packet (HTTP, DNS, UDP, etc). The router will use these fields of the packet to make routing decisions (ie. Forward to Router B if dst_ip_address==10.2.2.3, or Drop packets with src_tl_port=80)

Routing Rules

You will read in a set of routing rules (actions) from an external csv file. There are three possible actions:
Consider the following rules:


Router A gets 3 rules. If router A ever receives a packet that has a destination IP address of 10.1.1.2, it will always forward it to Router B. If a packet ever arrives with a destination IP address of 10.1.1.3, it will always forward it to router C. If router A gets a packet with a destination IP address of 10.1.1.5, it will drop the packet and move onto the next packet in the queue.

From that small snippet of rules defined above, consider a packet arrives to Router A that has a destination IP address of 10.1.1.3. Router A will check its rules, and see that it needs to forward it to Router C. The packet then arrives at router C, and router C will check its rules. Router C has a rule to drop all packets that have a dst_ip_address of 10.1.1.3, so the packet will be dropped bt router C.

Router Subroutine.

Whenever a packet arrives to router, that same procedure is usually followed.

Network setup

You will also need to define a Router class.    Class Router {} For router A, it will have a list of IP addresses of [10.6.6.3], and its connections will be [B,C], and it will have three rules { Forward=B: dst_ip_address=10.1.1.2, Forward=C : dst_ip_address=10.1.1.3, Drop : dst_ip_address=10.1.1.5 }. The data types do not have to be the same, but you will need a data structure to hold this information for each router.

You will read in this information in from a file (routers.txt)

Programs

You will develope two files. The first is network.py which will have the logic for receiving the packet, and then sending the packet throughout the network. This is where you will implement all your parsing and rule checking. The second file you need is simulation.py, and its only purpose is to send packets (via sockets) to network.py.

You will send several packets, and the packets information will be read in from a text file (packets.txt) You will run these programs via the command line, and pass in the host information as command line arguments. The format will be
You will have to create a Packet object for each row in this file.

Programming Language

You are allowed to use a programming language of your choice. Although, you must use a language that supports: Python is the support language for this class, so Reese will not be able to help with technical issues or syntax issues if you select a language other than Python. Java, Rust, Go, C/C++ are all valid languages to use.

Input Files

Sample output

Click here to see an expected output of your program. You program output does not have to match that exactly, but your program should print out the trace of the actions taken at each router.

Assumptions

Hints

Video Demo

You will record a video demo that highlights the functionality of your program. You can do this with Panopto, or you can record with another recording software (such as OBS) and post it to youtube as private or unlisted. Your video demo must also provide us a brief walkthrough of your code. This means your video demo will require commentary. Especially if you are using a language other than Python/Java, it will help Reese/Justin see that you followed the instructions.

Partners

You are allowed to work with 1 (one) partner. If you work with a partner, you should only create one private repository.

Submission Info

NEW: BOTH MEMBERS MUST SUBMIT A REPO LINK TO D2L. All files should be pushed to your repository. You still need a README that contains the video link and information about your program.

Grading Rubric (100 Points)

Requirement Points
Your program reads in input from three files: router.csv rules.csv and packets.csv 10
You have a packet class/struct that contains information about the protocol, src/dst ports and src/dst ip addresses 5
You have a router class/struct that contains information about the router number, ip addresses, and links 5
Your simulation program sends packets to the network program via sockets 10
Your network program can forward packets correctly 20
Your network program can drop packets correctly 20
Your network program can modify packets correctly 20
Your solution exists in your GitHub repo that has a README.md describing how to run your program. 10


Penalties

Helpful Examples

















Solution