Giter Site home page Giter Site logo

frndmg / containernet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from containernet/containernet

0.0 2.0 0.0 3.03 MB

Mininet fork adding support for container-based (e.g. Docker) emulated hosts.

Home Page: https://containernet.github.io

License: Other

Makefile 0.53% Shell 9.47% Python 78.34% C 11.48% Dockerfile 0.19%

containernet's Introduction

Containernet

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

Containernet: Mininet fork that allows to use Docker containers as hosts in emulated networks

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


Cite this work

If you use Containernet for your research and/or other publications, please cite (beside the original Mininet paper) the following paper to reference our work:


NFV multi-PoP Extension

There is an extension of Containernet called son-emu which is a full-featured multi-PoP emulation platform for NFV scenarios which is developed as part of the SONATA project.


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
    • Change 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

Installation

Containernet comes with three installation and deployment options.

Option 1: Bare-metal installation

Automatic installation is provided through an Ansible playbook.

  • Requires: Ubuntu Linux 16.04 LTS
    $ sudo apt-get install ansible git aptitude
    $ git clone https://github.com/containernet/containernet.git
    $ cd containernet/ansible
    $ sudo ansible-playbook -i "localhost," -c local install.yml
    $ cd ..
    $ sudo python setup.py install
    Wait (and have a coffee) ...

Option 2: Nested Docker deployment

Containernet can be executed within a privileged Docker container (nested container deployment). There is also a pre-build Docker image available on Docker Hub.

# build the container locally
$ docker build -t containernet .
# or pull the latest pre-build container
$ docker pull containernet/containernet
# run the container
$ docker run --name containernet -it --rm --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock containernet/containernet /bin/bash

Option 3: Vagrant-based VM creation

There are to diffrent ways to use Vagrant.

1. in the Containernet directory

If you run the following commands in the cloned repository.

$ vagrant up
$ vagrant ssh

You will get a VM that has the full directory structure sync with /home/ubuntu/containernet. If you want to contribute to the Containernet project. This is probably what you want.

2. in a seprate directory

If you want to use Containernet as a dependancy in your own project. You can use:

$ curl https://raw.githubusercontent.com/containernet/containernet/master/StandaloneVagrantfile -o Vagrantfile

to download the StandaloneVagrantfile, which is automatically renamed to Vagrantfile by the curl command. This Vagrantfile will download all nessarry parts needed to get up and running. This means your project structure stays slim.

To start the VM just run

$ vagrant up

After the VM has started, you can use the following command to login as root.

$ vagrant ssh

This is needed because mininet needs full access. If you use PyCharm Professional you can use the created VM as a remote interpreter.

Usage / Run

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

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

Topology example

In your custom topology script you can add Docker hosts as follows:

info('*** Adding docker containers\n')
d1 = net.addDocker('d1', ip='10.0.0.251', dimage="ubuntu:trusty")
d2 = net.addDocker('d2', ip='10.0.0.252', dimage="ubuntu:trusty", cpu_period=50000, cpu_quota=25000)
d3 = net.addHost('d3', ip='11.0.0.253', cls=Docker, dimage="ubuntu:trusty", cpu_shares=20)
d4 = net.addDocker('d4', dimage="ubuntu:trusty", volumes=["/:/mnt/vol1:rw"])

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

Contact

Support

If you have any questions, please use GitHub's issue system or Containernet's Gitter channel to get in touch.

Contribute

Your contributions are very welcome! Please fork the GitHub repository and create a pull request. We use Travis-CI to automatically test new commits.

Lead developer

Manuel Peuster

containernet's People

Contributors

adferguson avatar babisk avatar backb1 avatar bentenshan avatar bocon13 avatar cdburkard avatar cgeoffroy avatar ggee avatar javacruft avatar jonaswre avatar jonohart avatar lantz avatar moijes12 avatar mpeuster avatar mrcdb avatar msvbhat avatar murphymc avatar pantuza avatar pichuang avatar remyleone avatar rlane avatar ryancox avatar setchring avatar souvikdas95 avatar stevenvanrossem avatar thinred avatar vitalivanov avatar xschlef avatar yeasy avatar yungshenglu 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.