Coder Social home page Coder Social logo

p4-barge's Introduction

P4 Language Tutorials on Barge with Vagrant

This repo creates a P4 Language Tutorials Environment in a Docker container on Barge with Vagrant instantly.

Requirements

Start Up an Environment for the P4 Tutorials

$ vagrant up
$ vagrant ssh
[bargee@barge ~]$ docker run -it --rm --privileged -v /lib/modules:/lib/modules:ro -v /vagrant/tutorials:/home/p4/tutorials --name p4-tutorials --hostname p4-barge ailispaw/p4-tutorials:v2
p4@p4-barge:~$ 

Run a Tutorial

p4@p4-barge:~$ cd tutorials/exercises/basic
p4@p4-barge:~/tutorials/exercises/basic$ make build
mkdir -p build pcaps logs
p4c-bm2-ss --p4v 16 --p4runtime-file build/basic.p4info --p4runtime-format text -o build/basic.json basic.p4
p4@p4-barge:~/tutorials/exercises/basic$ make run
mkdir -p build pcaps logs
sudo python ../../utils/run_exercise.py -t topology.json -b simple_switch_grpc
Reading topology file.
Building mininet topology.
Switch port mapping:
s1:  1:h1 2:s2  3:s3
s2:  1:h2 2:s1  3:s3
s3:  1:h3 2:s1  3:s2
.
.
.

mininet> 

To Login a Mininet Node

Because it doesn't have a GUI window, we can not use mininet's (g|x)term command.
You can use the ./contrib/term.sh script in another terminal instead.

  • Open another terminal.
  • Then,
$ vagrant ssh
[bargee@barge ~]$ /vagrant/contrib/term.sh h1
root@<h1>:~# 
  • Or if you have Docker client in your local machine, you can log into the node directly.
$ ./contrib/term.sh h1
root@<h1>:~# ifconfig
h1-eth0   Link encap:Ethernet  HWaddr 00:00:00:00:01:01
          inet addr:10.0.1.1  Bcast:10.0.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1416 (1.4 KB)  TX bytes:90 (90.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

p4-barge's People

Contributors

ailispaw avatar

Watchers

 avatar  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.