Skip to content

Mininet fork. Extends Mininet API to use Docker containers as Mininet hosts.

License

Notifications You must be signed in to change notification settings

hadik3r/containernet

 
 

Repository files navigation

Containernet

Join the chat at https://gitter.im/mpeuster/containernet Build Status

Use Docker containers as hosts inside your Mininet topologies. Interact with the containers through Mininet's CLI.

This fork of Mininet allows to use Docker containers as Mininet hosts. This enables interesting functionalities to built networking/cloud testbeds. The integration is done by subclassing the original Host class.

Based on: Mininet 2.2.1

  • WIP! Not fully functional yet.
  • Contributions welcome :-)

Features

  • Add, remove Docker containers to Mininet topologies
  • Connect Docker containers to topology (to switches, other containers, or legacy Mininet hosts )
  • Execute commands inside Docker containers by using the Mininet CLI
  • Dynamic topology changes (lets behave like a small cloud ;-) )
  • Add Hosts/Docker containers to a running Mininet topology
  • Connect Hosts/Docker containers to a running Mininet topology
  • Remove Hosts/Docker containers/Links from a running Mininet topology
  • Resource limitation of Docker containers
  • CPU limitation with Docker CPU share option
  • CPU limitation with Docker CFS period/quota options
  • Memory/swap limitation
  • UPDATE CPU/Mem limitations at runtime!
  • Traffic control links (delay, bw, loss, jitter)
  • (missing: TCLink support for dynamically added containers/hosts)
  • Automated unit tests for all new features
  • Automated installation based on Ansible playbook

Dependencies

  • Ubuntu 14.04 LTS
  • Docker
  • docker-py

Installation

Automatic installation is provide through an Ansible playbook.

  • Requires: Ubuntu 14.04 LTS
  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install ansible git
  • sudo vim /etc/ansible/hosts
  • Add: localhost ansible_connection=local
  • git clone https://github.com/mpeuster/containernet.git
  • cd containernet/ansible
  • sudo ansible-playbook install.yml
  • Wait (and have a coffee) ...

Usage / Run

Start example topology with some empty Docker containers connected to the network.

  • cd containernet
  • run: sudo python examples/dockerhosts.py
  • use: containernet> d1 ifconfig to see config of container d1

Tests

There is a set of Containernet specific unit tests located in mininet/test/test_containernet.py. To run these, do:

  • sudo py.test -v mininet/test/test_containernet.py

Cleanup

  • Run cd bin/; sudo clear_crash.sh to cleanup the environment after something went wrong.

Docker support

Containernet can be executed within a container itself. This results in a containers-inside-container setup and simplifies its distribution.

A pre-build image is also available on Docker Hub (auto build of latest code revision on GitHub):

To run the Containernet Docker image:

  • docker run -ti --rm=true --net=host --pid=host --privileged=true -v '/var/run/docker.sock:/var/run/docker.sock' mpeuster/containernet

To build the Containernet Docker image:

  • docker build -t containernet .

HINT: If you are using docker-machine on OS X, you have to execute the following before you can run Containernet inside a Docker container.

  • docker-machine ssh default "sudo modprobe openvswitch"

Credits

Containernet (c) 2015 by Manuel Peuster

Contact

Manuel Peuster manuel (dot) peuster (at) upb (dot) de

About

Mininet fork. Extends Mininet API to use Docker containers as Mininet hosts.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 78.2%
  • C 11.9%
  • Shell 9.4%
  • Makefile 0.5%