Inhaltsverzeichnis

Ryu SDN-Controller von Github auf MacOS X installieren

Der Vorteil der Ryu-Variante direkt von Github ist die direkte Versorgung mit Patches oder Erweiterungen. Generell wird das PyPi Projekt nur mit jedem Major Release versorgt.

Voraussetzungen

Die Installation

Ich empfehle die Installation in folgenden Schritten.

Ohne „virtualenv“ müllt man sich langsam aber sicher das System voll. Ich möchte eindringlich empfehlen dieses hilfreiche Werkzeug einzusetzen!

virtualenv erstellen & aktivieren

Macbook:Python Benny$ virtualenv ryu
New python executable in ryu/bin/python
Installing setuptools, pip...done.
Macbook:Python Benny$ source ryu/bin/activate
(ryu)Macbook:Python Benny$ 

Ryu Projekt forken und Upstream zum Originalprojekt herstellen

(ryu)Macbook:Python Benny$ cd ryu
(ryu)Macbook:ryu Benny$ git clone https://github.com/<EUER BENUTZERNAME>/ryu.git
Cloning into 'ryu'...
remote: Counting objects: 16685, done.
remote: Total 16685 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (16685/16685), 18.83 MiB | 638.00 KiB/s, done.
Resolving deltas: 100% (12161/12161), done.
Checking connectivity... done.
(ryu)Macbook:ryu Benny$ git remote add upstream https://github.com/osrg/ryu.git
(ryu)Macbook:ryu Benny$ git remote -v
origin	https://github.com/<EUER BENUTZERNAME>/ryu.git (fetch)
origin	https://github.com/<EUER BENUTZERNAME>/ryu.git (push)
upstream	https://github.com/osrg/ryu.git (fetch)
upstream	https://github.com/osrg/ryu.git (push)

lxml zuerst installieren

Es ist wichtig das Kommando wie unten beschrieben einzugeben! lxml kompiliert sonst (zumindest bei mir) nicht!

(ryu)Macbook:ryu Benny$ STATIC_DEPS=true pip install lxml
Downloading/unpacking lxml
  Downloading lxml-3.3.5.tar.gz (3.5MB): 3.5MB downloaded
  Running setup.py (path:/Users/Benny/Python/ryu/build/lxml/setup.py) egg_info for package lxml
  
  (... Jede Menge CLI-Kilometer ausgelassen ...)
  
Successfully installed lxml
Cleaning up...

Ryu installieren

(ryu)Macbook:ryu Benny$ python ./setup.py install

Installed /Users/Benny/Python/ryu/ryu/pbr-0.10.0-py2.7.egg
running install
Downloading/unpacking eventlet
  Downloading eventlet-0.15.2-py2.py3-none-any.whl (150kB): 150kB downloaded
Requirement already satisfied (use --upgrade to upgrade): lxml in /Users/Benny/Python/ryu/lib/python2.7/site-packages
Downloading/unpacking msgpack-python>=0.3.0
  Downloading msgpack-python-0.4.2.tar.gz (114kB): 114kB downloaded
  Running setup.py (path:/Users/Benny/Python/ryu/build/msgpack-python/setup.py) egg_info for package msgpack-python
  
  (... Jede Menge CLI-Kilometer ausgelassen ...)
  
running install_data
creating /Users/Benny/Python/ryu/etc
creating /Users/Benny/Python/ryu/etc/ryu
copying etc/ryu/ryu.conf -> /Users/Benny/Python/ryu/etc/ryu
running install_egg_info
Copying ryu.egg-info to /Users/Benny/Python/ryu/lib/python2.7/site-packages/ryu-3.14-py2.7.egg-info
running install_scripts
Installing ryu-manager script to /Users/Benny/Python/ryu/bin
Installing ryu script to /Users/Benny/Python/ryu/bin
(ryu)Macbook:ryu Benny$

Mögliche Fehlermeldung beim ersten Start!

(ryu)Macbook:ryu Benny$ ryu-manager ryu/app/simple_switch_13.py 
Traceback (most recent call last):
  File "/Users/Benny/Python/ryu/bin/ryu-manager", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/Users/Benny/Python/ryu/lib/python2.7/site-packages/pkg_resources.py", line 2697, in <module>
    working_set.require(__requires__)
  File "/Users/Benny/Python/ryu/lib/python2.7/site-packages/pkg_resources.py", line 669, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/Users/Benny/Python/ryu/lib/python2.7/site-packages/pkg_resources.py", line 572, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pbr>=0.6,!=0.7,<1.0

Lösung

(ryu)Macbook:ryu Benny$ pip install pbr
Downloading/unpacking pbr
  Downloading pbr-0.10.0-py2.py3-none-any.whl (63kB): 63kB downloaded
Requirement already satisfied (use --upgrade to upgrade): pip in /Users/Benny/Python/ryu/lib/python2.7/site-packages (from pbr)
Installing collected packages: pbr
Successfully installed pbr
Cleaning up...

Ryu in Aktion!

(ryu)Macbook:ryu Benny$ ryu-manager --verbose ryu/app/simple_switch_13.py 
loading app ryu/app/simple_switch_13.py
loading app ryu.controller.ofp_handler
instantiating app ryu/app/simple_switch_13.py of SimpleSwitch13
instantiating app ryu.controller.ofp_handler of OFPHandler
BRICK SimpleSwitch13
  CONSUMES EventOFPSwitchFeatures
  CONSUMES EventOFPPacketIn
BRICK ofp_event
  PROVIDES EventOFPSwitchFeatures TO {'SimpleSwitch13': set(['config'])}
  PROVIDES EventOFPPacketIn TO {'SimpleSwitch13': set(['main'])}
  CONSUMES EventOFPEchoRequest
  CONSUMES EventOFPSwitchFeatures
  CONSUMES EventOFPErrorMsg
  CONSUMES EventOFPPortDescStatsReply
  CONSUMES EventOFPHello

TODO: Hier noch erweitern .. :)