luaflow, an open source openflow controller · luaflow, an open source openflow controller raphael...
TRANSCRIPT
![Page 1: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/1.jpg)
LuaFlow, an open source Openflow Controller
Raphael [email protected]
Renato [email protected]
Workshop 2012
![Page 2: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/2.jpg)
Talk Overview
• What is OpenFlow?• How OpenFlow Works
• Lua Flow approach
• Demo• Next steps
![Page 3: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/3.jpg)
Specialized Packet Forwarding Hardware
App
App
App
Specialized Packet Forwarding Hardware
App
App
App
Specialized Packet Forwarding Hardware
App
App
App
Specialized Packet Forwarding Hardware
App
App
App
Specialized Packet Forwarding Hardware
OperatingSystem
OperatingSystem
OperatingSystem
OperatingSystem
OperatingSystem
App
App
App
3
Current Internet Closed to Innovations in the Infrastructure
![Page 4: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/4.jpg)
Specialized Packet Forwarding Hardware
App
App
App
Specialized Packet Forwarding Hardware
App
App
App
Specialized Packet Forwarding Hardware
App
App
App
Specialized Packet Forwarding Hardware
App
App
App
Specialized Packet Forwarding Hardware
OperatingSystem
OperatingSystem
OperatingSystem
OperatingSystem
OperatingSystem
App
App
App
Network Operating System
App App App
“Software Defined Networking” approachto open it
![Page 5: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/5.jpg)
App
Simple Packet Forwarding Hardware
Simple Packet Forwarding Hardware
Simple Packet Forwarding Hardware
App App
Simple Packet Forwarding Hardware Simple Packet
Forwarding Hardware
Network Operating System
1. Open interface to hardware
3. Well-defined open API2. At least one good operating system
Extensible, possibly open-source
The “Software-defined Network”
![Page 6: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/6.jpg)
What is OpenFlow?
![Page 7: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/7.jpg)
Short Story: OpenFlow is an API
• Control how packets are forwarded• Make deployed networks programmable
– not just configurable
• Makes innovation easier• Goal (experimenter’s perspective):
– No more special purpose test-beds– Validate your experiments on deployed
hardware with real traffic at full line speed
![Page 8: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/8.jpg)
How Does OpenFlow Work?
![Page 9: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/9.jpg)
Ethernet Switch
![Page 10: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/10.jpg)
Data Path (Hardware)Data Path (Hardware)
Control PathControl PathControl Path (Software)Control Path (Software)
![Page 11: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/11.jpg)
Data Path (Hardware)Data Path (Hardware)
Control PathControl Path OpenFlowOpenFlow
OpenFlow ControllerOpenFlow Controller
OpenFlow Protocol (SSL/TCP)
![Page 12: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/12.jpg)
Controller
PC
HardwareLayer
SoftwareLayer
Flow Table
MACsrc
MACdst
IPSrc
IPDst
TCPsport
TCPdport Action
OpenFlow Firmware
**5.6.7.8*** port 1
port 4port 3port 2port 1
1.2.3.45.6.7.8
OpenFlow Flow Table Abstraction
![Page 13: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/13.jpg)
OpenFlow BasicsFlow Table Entries
SwitchPort
MACsrc
MACdst
Ethtype
VLANID
IPSrc
IPDst
IPProt
TCPsport
TCPdport
Rule Action Stats
1. Forward packet to port(s)2. Encapsulate and forward to controller3. Drop packet4. Send to normal processing pipeline5. Modify Fields
+ mask what fields to match
Packet + byte counters
![Page 14: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/14.jpg)
ExamplesSwitching
*
SwitchPort
MACsrc
MACdst
Ethtype
VLANID
IPSrc
IPDst
IPProt
TCPsport
TCPdport Action
* 00:1f:.. * * * * * * * port6
Flow Switching
port3
SwitchPort
MACsrc
MACdst
Ethtype
VLANID
IPSrc
IPDst
IPProt
TCPsport
TCPdport Action
00:20.. 00:1f.. 0800 vlan1 1.2.3.4 5.6.7.8 4 17264 80 port6
Firewall
*
SwitchPort
MACsrc
MACdst
Ethtype
VLANID
IPSrc
IPDst
IPProt
TCPsport
TCPdport Forward
* * * * * * * * 22 drop
![Page 15: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/15.jpg)
ExamplesRouting
*
SwitchPort
MACsrc
MACdst
Ethtype
VLANID
IPSrc
IPDst
IPProt
TCPsport
TCPdport Action
* * * * * 5.6.7.8 * * * port6
VLAN Switching
*
SwitchPort
MACsrc
MACdst
Ethtype
VLANID
IPSrc
IPDst
IPProt
TCPsport
TCPdport Action
* * vlan1 * * * * *
port6, port7,port9
00:1f..
![Page 16: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/16.jpg)
OpenFlowSwitch.org
Controller
OpenFlow Switch
PC
OpenFlow UsageDedicated OpenFlow Network
OpenFlow Switch
OpenFlow Switch
OpenFlowProtocol
Rule Action Statistics
Rule Action Statistics Rule Action Statistics
AliceBob
![Page 17: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/17.jpg)
Experiment Design Decisions
• Forwarding logic (of course)• Centralized vs. distributed control• Fine vs. coarse grained rules
• Reactive vs. Proactive rule creation
• Likely more: open research area
![Page 18: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/18.jpg)
Centralized vs Distributed Control
Centralized Control
OpenFlow Switch
OpenFlow Switch
OpenFlow Switch
Controller
Distributed Control
OpenFlow Switch
OpenFlow Switch
OpenFlow Switch
Controller
Controller
Controller
![Page 19: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/19.jpg)
Flow Routing vs. AggregationBoth models are possible with OpenFlow
Flow-Based
• Every flow is individually set up by controller
• Exact-match flow entries• Flow table contains one
entry per flow• Good for fine grain
control, e.g. campus networks
Aggregated
•One fow entry covers large groups of fows•Wildcard fow entries•Flow table contains one entry per category of fows•Good for large number of fows, e.g. backbone
![Page 20: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/20.jpg)
Reactive vs. Proactive Both models are possible with OpenFlow
Reactive
• First packet of flow triggers controller to insert flow entries
• Efficient use of flow table
• Every flow incurs small additional flow setup time
• If control connection lost, switch has limited utility
Proactive
•Controller pre-populates fow table in switch•Zero additional fow setup time•Loss of control connection does not disrupt traffic•Essentially requires aggregated (wildcard) rules
![Page 21: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/21.jpg)
Examples of OpenFlow in Action
• VM migration across subnets• Identity-Based QoS• Energy-efficient data center network• Network slicing• Load balancing (DNS for instance)
![Page 22: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/22.jpg)
![Page 23: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/23.jpg)
Slide Credits
• Guido Appenzeller• Nick McKeown• Guru Parulkar
• Brandon Heller
• Rob Sherwood• Lots of others
– (this slide was also stolen)
![Page 24: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/24.jpg)
LuaFlow's approach
![Page 25: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/25.jpg)
Official Open Source controllers
• NOX (Python/C)– Mixed approach
• Beacon (Java)– Focus in production environments– Java “enterprise” code
• Trema (Ruby)– Focus on prototyping testing
![Page 26: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/26.jpg)
There's a strong correlation between the length of code (number of tokens) and programmers' productivitye.g. Arc Programming Language [Paul Graham]
With smaller code:- less time to write consistent code
- less chances for bugs
LuaFlow is specialized for programmers' productivity, But not compromising efficiency
Write it short
![Page 27: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/27.jpg)
... because we write it in C and Lua(NOX written in C++ and Python, Beacon written in Java)
This is the main reason!
Why LuaFlow
![Page 28: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/28.jpg)
switches{switch1 = {datapath_id = "00:00:00:00:00:00:00:01"},switch2 = {datapath_id = "00:00:00:00:00:00:00:02"},}
hosts{host1 = {mac = "00:00:00:00:00:03"},host2 = {mac = "00:00:00:00:00:04"},}
-- Connections: Connection.switch[port#] = {switch=port#} or-- Connection.switch[port#] = {host} or-- Connection.host = {switch=port#}
Connection.host1 = { switch1 = 2}Connection.host2 = { switch2 = 2}Connection.switch1[1] = { switch2 = 1}
Network configuration file
![Page 29: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/29.jpg)
![Page 30: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/30.jpg)
![Page 31: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/31.jpg)
![Page 32: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/32.jpg)
![Page 33: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/33.jpg)
# NOX Pythoninst.install_datapath_flow( dpid, extract_flow(packet), CACHE_TIMEOUT, openflow.OFP_FLOW_PERMANENT, [[openflow.OFPAT_OUTPUT, [0, prt[0]]]], bufid, openflow.OFP_DEFAULT_PRIORITY, inport, buf)
# Luaflowadd_simple_flow(dpid, flow, buffer_id, out_port, cache_timeout)
VS
![Page 34: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/34.jpg)
Catching network events
function switch_ready(dpid, features)function switch_ready(dpid, features) print(">> New switch connected: " .. dpid) for k,v in pairs(features) do if k == "ports" then for i,p in ipairs(v) do print("Port " .. i) for k1,v1 in pairs(p) do print(k1, v1) end end else print(k, v) end endend
![Page 35: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/35.jpg)
Catching network events
function packet_in(dpid, buffer_id, flow) print(">> New packet (" .. buffer_id .. ") received from " .. dpid) local idle_timeout = 10 local out_port = "all" add_simple_flow(dpid, flow, buffer_id, out_port, idle_timeout)end
![Page 36: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/36.jpg)
Base classes
● base_config.lua● custom_topology_config.lua ● Topology.lua● Port.lua ● Host.lua ● Switch.lua ● Link.lua ● Dijkstra.lua● Controller.lua ● Flow.lua
![Page 37: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/37.jpg)
Base classesrequire "Topology"
myTopology = Topology:new{name = "mininet"}myTopology:load_config("custom_topology_config.lua")
function switch_ready(dpid, features) print(">> New switch connected: " .. dpid) --TODO --Insert switch features into switch objectsend
function packet_in(dpid, buffer_id, flow)
print(">> New packet received from " .. dpid) route = myTopology:getRoute(flow.dl_src, flow.dl_dst) ...end
![Page 38: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/38.jpg)
Demo
![Page 39: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/39.jpg)
Next steps
• Pure lua controller using ffi/luajit
• More real-world scenarios
• Serious evaluation• Open WRT Openflow wireless devices• Community pull-requests
– Both ideas & Code
![Page 40: LuaFlow, an open source Openflow Controller · LuaFlow, an open source Openflow Controller Raphael Amorim raphael@atlantico.com.br raphael.leite@hp.com Renato Aguiar aguiar_renato@atlantico.com.br](https://reader030.vdocuments.us/reader030/viewer/2022021418/5adacab97f8b9a86378dd1c1/html5/thumbnails/40.jpg)
Questions?
Thank you all