Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

weiserchen/P4-SFC

 
 

Repository files navigation

Implementing a Simple SFC using p4

This is a simple SFC implemented on P4.

Project Structure

  • template: They are templates for both internal switch and edge switches.
  • utils: This also comes from p4tutorial. It provides many useful library and scripts to manipulate p4runtime.
  • vm-ubuntu-20.04: This is our experiment environment. Use vagrant up to setup the virtual machine, still comes from p4tutorial.
  • controllers: This is where we put our controllers in.

Usage

  1. Compile p4 programs and launch mininet.
make sfc
  1. Install rules on p4 switches
./controller/install.py
  1. Check connection
  • Method 1: using ping (ICMP)
mininet> h1 ping h2
mininet> h2 ping h1
  • Method 2: using TCP
# It will open terminal for host 1 and host 2
mininet> xterm h1 h2

# You can modify the iface to listen on different NIC
h2> ./receive.py eth0

# 10.0.2.2 is the destination ip address (see topo/topology.json)
h1> ./send.py 10.0.2.2
  1. Cleanup
# 1. Type Ctrl+d

# 2. Clean up the resources
make clean

Testing Connection

The simplest way to test connection between switches and hosts is to user our send.py and receive.py.

  1. First, you have to send up where to listen the packet. The benefits of listening on ports of switches are to see if a packet did be send to some port.
# 1. Testing connection between host
mininet> xterm h1 h2

# The only interface on host is eth0
h2> ./receive.py eth0

# 2. Test connection between host and switch
mininet> xterm h1 s4

# The interface of switch is [switch name]-[port number]
s4> ./receive.py s4-eth3
  1. Second, just use send.py to send packet.
h1> ./send.py 10.0.2.2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 55.9%
  • P4 27.3%
  • Shell 7.5%
  • Emacs Lisp 3.4%
  • TeX 3.0%
  • Vim Script 2.0%
  • Makefile 0.9%