RYU Simple Switch Application


With just the controller connected without any application, the ping between the PCs cannot work because the ARP requests are forwarded to the controller without any packet processing instructions in the flow tables. RYU code distribution comes with a set of applications to show how applications can be integrated. The following instructions will show how to run the simple switch application. The application processes the packet_in messages (e.g., ICMP_REQUEST) and instructs the bridge to flood all other ports with the packets once the destination host has received the request and has replied with its MAC address. This simple switch application sets up the flow table to forward traffic from source port to the correct destination port. This is the default switch behavior that we have tested before. The application is in the $home/ryu/ryu/application directory. Run the ryu-manager –verbose simple_switch.py command to start the application.

Figure 11 – RYU-manager with simple switch application

Once the simple switch application starts, the first part of the message output is the same as before, but instead of receiving unhandled events only as the previous RYU-manager only run, it sends an OFPT_PACKET_OUT message to the switch with FLOOD actions on first two packet_in messages. The first one is a probe message sent by the controller on local port. 

Figure 12 – Switch responses with simple switch application

The second message is an ICMP request that comes in from port 3 and has a target destination of port 4. This message is the result of a ping test running on the PC connected to port 3 to PC on port 4. Since the controller does not know which port has the PC 4 MAC address. It sends the OFPT_PACKET_OUT instruction to the switch to flood the message received on port 3. Once the PC on port 4 receives the ICMP request, it responds with its reply. The controller matches the reply destination MAC address with the PC3 on port3 and sends an OFPT_FLOW_MOD action to create a flow from port 4 to port 3 to forward the packets. The same process repeats again for setting up flows from port 3 and port 4.

Figure 13 – Flow tables set up by simple switch application

As a result, the dump-flows show 2 flows created by the simple switch application. To test it again, simply use del-flows command to delete the flow.

Figure 14 – Delete flow event from switch to controller


Once the flows are deleted, two OPEN_FLOW_REMOVED events are generated by the switch to notify the controller. The MAC learning process repeats itself again. The two flows will be created when the next round of the ICMP requests come into the controller. User can dump the flow table to verify its behavior. At this point, the starter kit has demonstrated the basic RYU controller integration with OVS and a simple application built on top of the RYU controller. Reader should be able to start testing and writing test applications using the SDN platform presented in this document.

Copyright © 2024 Pica8 Inc. All Rights Reserved.