Wednesday, June 15, 2016

RAUCET - Raspberry Pi + FAUCET, controlling Zodiac FX

In this post, we will set up a Raspberry Pi 3, to control a Zodiac FX (we will cover NFV in the same combination in a future post).


  • A Raspberry Pi 3 (a 2 might work) with power supply
  • A Zodiac FX
  • A USB Ethernet adaptor compatible with the Pi (I used a Mac 100M adaptor, but others may work)
You could also manage the Pi over WiFi, and just use the Pi's built in Ethernet to do OpenFlow, if you don't have an adaptor to spare.


  • Install at least v0.63 firmware on the ZodiacFX (see the ZodiacFX forums for firmware and user manual; you will need a x86 based computer to run the Atmel firmware updater tool, as the tool will not run on the Pi itself).
  • Configure a static IP address, on the Pi's interface that be the OpenFlow control plane network. We will use what the Zodiac FX expects for simplicity. Assuming that the adaptor is eth1, add this to your /etc/network/interfaces on the Pi. 

auto eth1
iface eth1 inet static
  • Reboot to have the change take effect.
  • Connect cables to the ZodiacFX (as shown), and check that you can ping the Zodiac
  • Install FAUCET's dependencies on the Pi.
sudo apt-get install git minicom libpython-dev python-yaml paramiko
sudo pip install ipaddr
sudo pip install --upgrade six
sudo pip install ryu
  • Install FAUCET itself, in /home/pi
git clone
  • Obtain the ZodiacFX's MAC address from the label on the underside. Or, use minicom to obtain the address:
sudo minicom -s
(change serial port to /dev/ttyACM0, under serial port options - check dmesg)

Then, via minicom:

show config

On my ZodiacFX, I have the following:

Zodiac_FX# config
Zodiac_FX(config)# show config

 Name: Zodiac_FX
 MAC Address: 70:B3:D5:6C:D0:C0
 IP Address:
 OpenFlow Controller:
 OpenFlow Port: 6633
 Openflow Status: Enabled
 Failstate: Secure
 Force OpenFlow version: Disabled
 Stacking Select: MASTER
 Stacking Status: Unavailable

  • Back on the Pi (quit from minicom with control-A, Q), create a FAUCET config file.
mkdir /home/pi/zodiacfx
vi /home/pi/zodiacfx/faucet.yaml
  • Convert the ZodiacFX MAC address to a FAUCET DPID.  My ZodiacFX's MAC is 70:B3:D5:6C:D0:C0 which is a DPID of0x70b3d56cd0c0 (running all the digits together, removing the ":"s, and prepending 0x).
  • In the faucet.yaml file, add this (replacing dp_id as above), and save and exit.

version: 2

        name: "100"
        dp_id: 0x70b3d56cd0c0 
        hardware: "ZodiacFX"
            native_vlan: 100 
            native_vlan: 100
            native_vlan: 100

  • Now start FAUCET itself:

export FAUCET_CONFIG=~/zodiacfx/faucet.yaml
export FAUCET_LOG=~/zodiacfx/faucet.log
export FAUCET_EXCEPTION_LOG=~/zodiacfx/faucet_exception.log
/usr/local/bin/ryu-manager --ofp-listen-host= --ofp-tcp-listen-port=6633 ~/faucet/src/ryu_faucet/org/onfsdn/faucet/ --verbose

If it works, you will see the following. You now have a working FAUCET switch! If you connect hosts to ports 1, 2, or 3 they should be able to reach each other.

loading app /home/pi/faucet/src/ryu_faucet/org/onfsdn/faucet/
loading app ryu.controller.ofp_handler
instantiating app None of DPSet
creating context dpset
instantiating app /home/pi/faucet/src/ryu_faucet/org/onfsdn/faucet/ of Faucet
instantiating app ryu.controller.ofp_handler of OFPHandler
BRICK dpset
  PROVIDES EventDPReconnected TO {'Faucet': set(['dpset'])}
  PROVIDES EventDP TO {'Faucet': set(['dpset'])}
  CONSUMES EventOFPPortStatus
  CONSUMES EventOFPSwitchFeatures
  CONSUMES EventOFPStateChange
BRICK Faucet
  CONSUMES EventOFPPortStatus
  CONSUMES EventOFPSwitchFeatures
  CONSUMES EventFaucetResolveGateways
  CONSUMES EventFaucetReconfigure
  CONSUMES EventFaucetHostExpire
  CONSUMES EventDPReconnected
BRICK ofp_event
  PROVIDES EventOFPPortStatus TO {'dpset': set(['main']), 'Faucet': set(['main'])}
  PROVIDES EventOFPErrorMsg TO {'Faucet': set(['main'])}
  PROVIDES EventOFPSwitchFeatures TO {'dpset': set(['config']), 'Faucet': set(['config'])}
  PROVIDES EventOFPStateChange TO {'dpset': set(['main', 'dead'])}
  PROVIDES EventOFPPacketIn TO {'Faucet': set(['main'])}
  CONSUMES EventOFPEchoReply
  CONSUMES EventOFPPortStatus
  CONSUMES EventOFPSwitchFeatures
  CONSUMES EventOFPPortDescStatsReply
  CONSUMES EventOFPEchoRequest
EVENT Faucet->Faucet EventFaucetResolveGateways
EVENT Faucet->Faucet EventFaucetHostExpire
connected socket:<eventlet.greenio.base.GreenSocket object at 0x75cdc210> address:('', 49946)
hello ev <ryu.controller.ofp_event.EventOFPHello object at 0x75cdc910>
move onto config mode
EVENT ofp_event->dpset EventOFPSwitchFeatures
EVENT ofp_event->Faucet EventOFPSwitchFeatures
switch features ev version=0x4,msg_type=0x6,msg_len=0x20,xid=0x5ce4692f,OFPSwitchFeatures(auxiliary_id=0,capabilities=7,datapath_id=123917682135232L,n_buffers=0,n_tables=10)
move onto main mode
EVENT ofp_event->dpset EventOFPStateChange
DPSET: register datapath <ryu.controller.controller.Datapath object at 0x75cdc510>
EVENT dpset->Faucet EventDP

Adding as a systemd service

Since Raspbian uses systemd, you can write a faucet.service file that causes FAUCET to be automatically run on boot.
  • Create a file /home/pi/zodiacfx/, made executable, containing:
export FAUCET_CONFIG=~/zodiacfx/faucet.yaml
export FAUCET_LOG=~/zodiacfx/faucet.log
export FAUCET_EXCEPTION_LOG=~/zodiacfx/faucet_exception.log
/usr/local/bin/ryu-manager --ofp-listen-host= --ofp-tcp-listen-port=6633 ~/faucet/src/ryu_faucet/org/onfsdn/faucet/ --verbose

  • Create a file /etc/systemd/system/faucet.service, containing:


  • Enable the service and start it:
sudo systemctl enable /etc/systemd/system/faucet.service
sudo systemctl start faucet.service

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.