Programming Assignment 2 Zilong Ye
Traditional router Control plane and data plane embed in a blackbox designed by the vendor high-seed switching fabric routing processor router input ports router output ports forwarding data plane (hardware) routing, management control plane (software) forwarding tables computed, pushed to input ports
Software-Defined Networking Decouple control plane from data plane Benefits: Fast innovation Global optimization Dynamic reconfiguration Flexibility Programmable network
OpenFlow OpenFlow – A representative SDN open protocol Secure channel Flow table
Header fields Header values for matching against packets Activity counter Update for matching packets Actions Actions taken on matching packets
Matching A packet matches a flow table entry if the values in the header fields used for the lookup (as defined above) match those defined in the ow table. If matching, perform the action and update the counter; If not matching, send the packet to the controller
Secure channel OpenFlow protocol Through this interface, the controller configures and manages the switch, receives events from the switch, and send packets out the switch. Three types of messages: Controller to switch Asynchronous Symmentric
Controller to switch Configuration The controller is able to set and query configuration parameters in the switch. Read state Read-State messages are used by the controller to collect statistics from the switchs flow-tables, ports and the individual flow entries. Modify state Their primary purpose is to add/delete and modify flows in the flow tables and to set switch port properties. Send packet These are used by the controller to send packets out of a speci- fied port on the switch.
Asynchronous Packet-in For all packets that do not have a matching ow entry, a packet-in event is sent to the controller (or if a packet matches an entry with a “send to controller" action). Fraction of packet header – sufficient buffer on switch Full packet – less buffer on switch Flow-removed Idle timeout – flow entries that lack activity Hard timeout – fixed lifetime of flow entry Port-status Error
Symmetric Hello Hello messages are exchanged between the switch and controller upon connection startup. Echo They can be used to indicate the latency, bandwidth, and/or liveness of a controller-switch connection. Can be used for efficient fault detection.
Trema OpenFlow controller + network emulator + Trema command
Trema controller Ruby and C class packetin < controller def packet_in (datapath_id, event) puts ‘received a packet’ info “” end
Network emulator Network DSL example
Trema command $ trema run packet-in.rb -c packet-in.conf $ trema send_packets --source host1 --dest host2 $ trema show_stats host1 $ trema dump_flows 0xabc
Programming assignment 2 Download and install VirtualBox Download Trema virtual machine Install the VM, start Virtual Box, select File->Import Appliance-> and select the downloaded.ova file. The VM requires 1G RAM and 8G disk. Username: cs470; password: trema Run examples: Hello switch Packet in
Hello switch./trema run src/examples/hello_trema/hello_trema.rb -c src/examples/hello_trema/hello_trema.conf
Packet in dumper./trema run src/examples/packet_in/packet-in.rb -c src/examples/packet_in/packet_in.conf
Useful APIs ter/frames ter/frames Go to “Controller” and get familiar with the APIs related to OpenFlow messages: Send_flow_mod_add Send_flow_mod_delete Send_message Send_packet_out