Coder Social home page Coder Social logo

minip4's Introduction

MiniP4

MiniP4 is a python utility to quickly create a Mininet network using P4 switches.

Install

From source

git clone https://github.com/joncastro/minip4
cd minip4
sudo python setup.py install

Dependencies

The dependencies to run MiniP4 are

git clone https://github.com/mininet/mininet.git
cd mininet
sudo python setup.py install
git checkout tags/2.2.1
cd ..
sed -i 's/git:\/\/openflowswitch.org\/openflow.git/https:\/\/github.com\/mininet\/openflow.git/g' mininet/util/install.sh
sed -i 's/git:\/\/gitosis.stanford.edu\/oflops.git/https:\/\/github.com\/mininet\/oflops.git/g' mininet/util/install.sh
# Mininet is installed with -n to avoid installing unnecessary openflow dependencies
mininet/util/install.sh -n
git clone https://github.com/p4lang/p4c-bm.git
cd p4c-bm
sudo pip install -r requirements.txt
sudo python setup.py install
cd ..
git clone https://github.com/p4lang/behavioral-model.git
cd behavioral-model
./install_deps.sh
./autogen.sh
aclocal && automake --add-missing && autoconf && autoreconf -fi
./configure --with-pdfixed
#./configure
make
sudo ln -s ${PWD}/targets/simple_switch/simple_switch /usr/local/bin/simple_switch
sudo ln -s ${PWD}/tools/runtime_CLI.py /usr/local/bin/runtime_CLI.py
cd ..

Usage

MiniP4 requires a topology file based in YAML to create a Mininet network using P4 switches. The topology file mainly contains the list of hots, switches and the links that connect them.

MiniP4 can be started executing mnp4 command. By default p4-topo.yml topology file will be used if not provided.

Topology YAML

The YAML file is composed on following sections.

Defaults

Defaults parameters to be used by default for host and switches.

hosts default parameters:

  • gw : default gateway
  • command: a list of default commands to be executed

switches default parameters:

  • p4src: p4 source file
  • dump: dump packets into a pcap file per interface
  • port: default port start number for thrift
  • commands: default switch commands
  • verbose: log level (trace,debug, info, warn, error, off). Default, info
  • sw_path: switch behavioral executable. Default, simple_switch
  • cli: p4 cli path. Default, runtime_CLI.py
  • compiler: p4 compiler path. Default, p4c-bmv2

Hosts

List of host

Mandatory parameters:

  • name: host name
  • ip: ip address

Optional parameters:

All default host parameters and following ones:

  • mac: if not provided and the name contains a digits, the mac will use the number of concatenating all digits and converted to mac address. For example, if name is h101c1 then mac address is 00:00:00:00:03:F3. Notice 0x03:F3 is the hex representation of 1011. If not, a random mac address will be calculated.

Switches

List of switch

Mandatory parameters:

  • name: switch name (mandatory)

Optional parameters if provided on defaults:

All default switch parameters and following ones:

  • id: if not provided and the name contains a digits, the id will be the number of concatenating all digits. For example, if name is s101c2, 1012 will be used as id. If not, a random id will be calculated.
  • port: thrift port

Links

List of link

  • source: source host or switch name
  • destination: destination host or switch name

Example

Example,

defaults:
  host:
    gw: 10.0.0.1
    command:
    - route add 8.8.8.0 dev eth0

  switch:
    sw_path: simple_switch
    compiler: p4c-bmv2
    cli: runtime_CLI.py
    p4src : p4src/vpc.p4
    dump: true
    port: 22222
    commands: commands.txt

host:
- ip: 10.0.1.1/16
  name: h101
- ip: 10.0.1.2/16
  name: h102
- ip: 10.0.1.3/16
  name: h103

switch:
- name: s101
- name: s102
- name: s103

link:
- source: h101
  destination: s101
- source: h102
  destination: s102
- source: h103
  destination: s103
- source: s101
  destination: s102
- source: s101
  destination: s103
- source: s102
  destination: s103

minip4's People

Contributors

joncastro avatar

Stargazers

 avatar  avatar  avatar

Watchers

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