OpenFlow Protocol: Programming Flow Tables on Open vSwitch
I programmed OpenFlow 1.3 flow tables directly on Open vSwitch using match-action rules with priorities, idle timeouts, and output actions. Installing proactive flows revealed exactly how the southbound protocol turns controller intent into packet forwarding.
Objective & Context
OpenFlow is the canonical SDN southbound protocol: a switch matches packet fields against prioritized table entries and applies actions. This lab manipulates flows by hand with ovs-ofctl to make the abstraction concrete before automating it from a controller.
Environment & Prerequisites
- Open vSwitch with OpenFlow 1.3 enabled; a Mininet topology.
- ovs-ofctl and ovs-vsctl tooling.
- Understanding of match fields (in_port, dl_dst, nw_dst).
flowchart LR
P[Packet] --> M{Match table entry?}
M -->|priority match| A[Apply action
output/drop/mod] M -->|miss| C[Send to controller]
output/drop/mod] M -->|miss| C[Send to controller]
Step-by-Step Execution
1. Install a proactive forwarding flow
ovs-ofctl -O OpenFlow13 add-flow s1 "priority=200,in_port=1,actions=output:2"2. Add a higher-priority drop rule
ovs-ofctl -O OpenFlow13 add-flow s1 "priority=300,ip,nw_dst=10.0.0.9,actions=drop"3. Inspect counters per flow
ovs-ofctl -O OpenFlow13 dump-flows s1priority=300,ip,nw_dst=10.0.0.9 actions=drop n_packets=14
priority=200,in_port=1 actions=output:2 n_packets=88
Validation & Testing
Send traffic and confirm the higher-priority drop wins over the forward rule, with packet counters incrementing on the matched entry. Pass criteria: priority ordering observed and counters confirm which flow handled each packet.
Advanced: Troubleshooting
- Flow not matching: a higher-priority entry may shadow it; dump and check ordering.
- Version errors: always pass
-O OpenFlow13consistently. - Flows expire: set
idle_timeout=0for permanent proactive rules.
Key Results
- Installed proactive flows with explicit priority and action semantics.
- Verified priority resolution between a forward and a drop rule.
- Read per-flow packet counters to confirm handling, not assumptions.
- Built the manual baseline later automated via an SDN controller app.