Git Product home page Git Product logo

ethernet-assingmnet-golang's Introduction

Review Assignment Due Date

Assignment: Ethernet Switch

Ethernet switch animation Ethernet hub animation

Overview

Ethernet resides in the L1 and L2 of the network stack. An IP packet is sent over the network as the payload of an ethernet frame. Initially the world had ethernet hubs, which is a L1 device. When an ethernet frame was received by a hub it was broadcast to all other ports on the hub. This is inefficient since often the frame was only intend for one destination. An advance in networking technology came when the ethernet switch was developed, a L2 device. The ethernet switch keeps a record of what destinations are connected to which ports. Therefore when a ethernet frame arrives at a port on an ethernet switch, it is only sent on the port that is connected to the destination.

In this assignment you will write a software implementation of an ethernet switch. The switch will have an arbitrary number of ports and will use store and forward packet switching with a configurable send queue buffer size. Store and forward simply means that the packets is fully read by the port on the switch and then forwarded to the appropriate port by looking at the forwarding table. Each port has a send queue (of configurable finite length) that is used to buffer frames as they are sent over the wire. The send queue is useful for providing a little buffer for slower ports (running at a lower line speed) and for the case when lots of incoming ports have frames destined for the same outgoing port. Ethernet switches do best effort delivery therefore if the send queue for a port is full then you must drop the packet and move on to processing the next frame.

Learning Objectives

  • Manage concurrency in Go with channels

Requirements

  • Your switch design needs to be non-blocking. This means that your ports must always read data from the outside without blocking on other activities (e.g., sending frames) within the switch.

  • The design must be free of deadlock, races, and livelock.

  • The switch must support IEEE 802.3 ethernet frames (L2) defined here. You only need to support payloads less than or equal to 1500 B (so no jumbo frame support).

  • Upon reading the frame you must validate the checksum in the frame. If the frame is invalid do not forward the frame. Instead simply drop it.

  • The switch must handle the special broadcast frame properly.

  • All ports must be full duplex.

  • To focus on the use of channels in this assignment, the use of the sync package is forbidden.

  • Your code will be graded on completeness and form.

  • You must only edit pkg/eth/switch.go.

  • Do not use any library other than the Go standard library.

  • The source code must compile with the most recent version of the Go compiler.

  • The program must not panic under any circumstances.

  • Make sure your code is "gofmt'd". See "gofmt" or better use "goimports" or better yet configure IDE to do this formatting on file save.

  • Commit and push your working code to your GIT repository.

Hints

  • The package "encoding/binary" and "hash/crc32" might come in handy when parsing and formatting ethernet frames.
  • Use the Makefile. For example, you can run tests with make test -B. To make sure your code is properly formatted run make fix.

Submission

  • Commit and push your working code to your GIT repository.
  • Ensure all tests pass otherwise you will receive no credit.

ethernet-assingmnet-golang's People

Contributors

ahmedsaleemkhan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.