8. Outline
❖ Introduction to RYU
❖ Environment Setup
❖ Basic RYU Operation
❖ RYU Application Development
❖ RYU Restful API
9. Environment Setup
❖ All-in-one tutorial VM contains:
❖ SDN Controllers: OpenDaylight, ONOS, RYU, Floodlight, Floodlight-
OF1.3, POX, and Trema
❖ Open vSwitch 2.3.0 with support for Openflow 1.2, 1.3 and 1.4, and
LINC switch
❖ Mininet to create and run example topologies
❖ Pyretic
❖ Wireshark 1.12.1 with native support for OpenFlow parsing
❖ JDK 1.8, Eclipse Luna, and Maven 3.3.3
❖ Update newest RYU version
$ cd ~/ryu
$ git fetch
$ git merge origin
$ python ./setup.py install http://sdnhub.org/tutorials/sdn-tutorial-vm/
10. Outline
❖ Introduction to RYU
❖ Environment Setup
❖ Basic RYU Operation
❖ RYU Application Development
❖ RYU Restful API
11. Basic RYU operation - CLI
❖ ryu-manager, ryu run
❖ 啟動ryu
❖ --h
❖ Show help message
❖ --verbose
❖ Show debug output
❖ --version
❖ Show program’s version
❖ --observe-links
❖ 定期發送 LLDP 封包
❖ Example:
$ cd ~/ryu/
$ ./bin/ryu-manager --observe-links ryu/app/simple_switch.py
ryu.app.simple_switch
16. Simple Switch – Example (2/4)
❖ Host A -> Host B
❖ Host A triggers Packet-In message
❖ Record Host A MAC
❖ Host B has not been found, the packets are flooded
❖ Host B and host C received
17. Simple Switch – Example (3/4)
❖ Host B -> Host A
❖ When the packets are returned from host B to host A
❖ Host B triggers Packet-In message
❖ Record Host B MAC
❖ Controller installs an entry to the flow table and also the
packets are transferred to port 1.
18. Simple Switch – Example (4/4)
❖ Host A -> Host B
❖ Controller installs an entry to the flow table
25. OpenFlow - Controller-to-Switch (1/6)
❖ Controller sends a Feature request message to the switch to get
the capabilities of a switch
❖ Switch must reply with a Feature reply that specifies the
capabilities supported by the switch
max packets buffered at once
capabilities supported by switch
flow statis, table statis, port statis, reassemble IP fragments,...
actions supported by the switch
SET_VLAN_VID, SET_DL_SRC, SET_DL_DST, ENQUEUE,...
describe all the physical ports (which support OpenFlow)
port no, hw addr, state,...
26. OpenFlow - Controller-to-Switch (2/6)
❖ SET_CONFIG
Controller send a SET_CONFIG message to set configuration parameters in
the switch
max bytes of new flow that switch should send to the controller
handling of IP fragments (normal, drop, reassemble,...)
❖ GET_CONFIG
Controller send a GET_CONFIG Request message to query configuration
parameters in the switch
Switch responds to a configuration request with an GET_CONFIG Reply
message
27. OpenFlow - Controller-to-Switch (3/6)
❖ Controller sends Packet_out of a specified port on the switch
buffer_id
in_port
port = TABLE
actions
28. OpenFlow - Controller-to-Switch (4/6)
❖ Controller send Flow_mod message to switch to
add/delete/modify flows in the flow tables
❖ match fields
❖ idle/hard timeout
❖ buffer_id
❖ actions
29. OpenFlow - Controller-to-Switch (5/6)
❖ Stats request is used by the controller to collect statistics
❖ Switches flow-tables, ports and the individual flow entries
❖ switch responds with one or more Stats reply messages
30. OpenFlow - Controller-to-Switch (6/6)
❖ Controller to ensure message dependencies have been met
or to receive notifications for completed operations
❖ Switch must finish processing all previously-received
messages before executing any messages beyond the Barrier
request
❖ switch must send an Barrier reply message when such
processing is complete
31. OpenFlow - Asynchronous
❖ Packet_in
❖ Packet_in message (event) is sent to the controller when
❖ a packet do not have a matching flow entry
❖ a packet matches an entry with a "send to controller" action
❖ Flow_removed
❖ Switch sends a Flow_removed message to controller when
❖ flow time out
❖ delete flow using Flow_removed message by controller
❖ Port_status
❖ As physical ports are added, modified, and removed from the switch
32. OpenFlow - Symmetric
❖ Hello
❖ Hello messages are exchanged between the switch and
controller upon connection startup
❖ version negotiation
❖ Echo
❖ indicate liveness of a controller-switch connection
❖ Vendor
❖ Offer additional functionality within the OpenFlow message type space
Editor's Notes
switch must reply with a FEATURES REPLY that specifies the capabilities supported by the switch
max packets buffered at once
capabilities supported by switch
flow statis, table statis, port statis, reassemble IP fragments,...
actions supported by the switch
SET_VLAN_VID, SET_DL_SRC, SET_DL_DST, ENQUEUE,...
describe all the physical ports (which support OpenFlow)
port no, hw addr, state,...