SDN controllers
Study notes on SDN controllers: what they are, how they work, types, APIs, placement and high-availability trade-offs, with worked examples and exam guidance.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
SDN controllers are the central software components that run the network logic in a software-defined network. Engineers use controllers when designing, programming and operating modern data-centre networks and campus networks to implement routing, switching, traffic engineering, monitoring and network services in a programmable, automated way.
Key ideas
Start from first principles: a network device forwards packets according to local rules. SDN separates the decision logic from forwarding. Build definitions step by step.
Software-Defined Networking (SDN): an architecture that separates the control plane (decision logic of how to forward flows) from the data plane (device that forwards packets). See other topics for control/data plane basics.
SDN Controller (Controller): the centralized or distributed software entity that implements the control plane. Exact definition: a software process (or cluster of processes) that maintains a global or partitioned view of the network, accepts network policies or applications, computes forwarding state, and programs forwarding devices using southbound protocols. Assumptions: controller can communicate reliably with switches (out-of-band or in-band) and the network devices support a southbound protocol.
Network Operating System (NOS): the controller’s internal platform that provides abstractions (topology, device registry, data store) and services (event bus, RPC, southbound adapters). Example components: topology manager, device manager, flow programmer. Examples of widely used controllers/NOS platforms: ONOS, OpenDaylight, Ryu, Floodlight.
Northbound API: the interface the controller exposes to network applications (usually REST, gRPC, or language-specific SDKs). A policy application uses the northbound API to request intents, flows or topology information.
East–West (inter-controller) API: interfaces used among controller instances/clusters to exchange topology/state and coordinate decisions in distributed or hierarchical designs.
Southbound API: the interface the controller uses to program/configure devices and collect state (OpenFlow, NETCONF/RESTCONF, OVSDB, P4Runtime, gNMI, PCEP). The controller translates its computed forwarding state into southbound messages and configuration transactions; the control channel is often secured (e.g., TLS with mutual authentication). Note: BGP-LS is not used to program devices; it is used by routers to advertise link-state topology to a controller.
Controller application (or app): a program running on/near the controller that implements a network function (e.g., routing, load balancing). The controller provides common services so apps don’t talk to switches directly.
Reactive vs Proactive installation: reactive installs rules upon first-packet miss (higher per-flow setup latency, lower upfront overhead); proactive pre-installs rules from policy/topology (lower latency for new flows, requires planning and table space).
Centralized vs Distributed vs Hierarchical controllers:
- Centralized: single logical controller. Simpler to reason about, but limited by performance, scale and single point of failure.
- Distributed (clustered): multiple controller instances share state (replication/consensus) to give fault tolerance and scale. Key assumptions: state consistency model (strong vs eventual) and consensus protocol (e.g., Raft) are used.
- Hierarchical: local controllers manage local devices and a higher-level controller coordinates global policies.
Consistency, Availability and Partition Tolerance (CAP) trade-offs: in controller clusters, you must choose how the data store behaves under network partitions. Controllers use consensus protocols to get strong consistency for critical state (but pay latency and reduced availability during partitions).
High Availability (HA): techniques include active-standby, active-active with state replication, and leader election. Assume controller platform provides membership and leader-election primitives.
Placement problem (controller placement): where to place controller instances in the network to minimize control-plane latency, balance load and provide resilience. Typical objective: minimize average or worst-case RTT from switches to their assigned controller(s).
Performance metrics: control-plane latency (time to install flow rule), flow-setup throughput (flows/second a controller can handle), state-convergence time after failure, and control link bandwidth.
Diagrams to draw (for exam answers):
- Draw a small network with 6 switches and 2 controllers. Label switches S1..S6, controllers C1,C2. Draw links and annotate RTTs to controllers.
- Draw a sequence diagram for reactive flow setup: switch -> controller (PACKET_IN), controller processing, controller -> switch (FLOW_MOD, PACKET_OUT).
Formulas
L_avg = (1/N) · Σ_{i=1..N} d(i, c(i))
- L_avg: average latency from switches to assigned controllers (s or ms). N: number of switches. d(i, c(i)): RTT or one-way delay from switch i to its assigned controller c(i). Applies to controller placement objective (minimize L_avg).
L_worst = max_{i=1..N} d(i, c(i))
- L_worst: worst-case switch-to-controller latency. Useful when SLA depends on maximum delay.
T_flow_setup = d_sw_ctrl + T_proc_ctrl + d_ctrl_sw + T_prog_sw
- T_flow_setup: time to establish a reactive flow (s or ms).
- d_sw_ctrl: network latency from switch to controller (one-way or half-RTT as used); d_ctrl_sw: controller to switch latency. T_proc_ctrl: controller processing time. T_prog_sw: time switch needs to program table. Applies to reactive flow performance estimation.
Controller_CLUSTER_STATE = replicate(state) using consensus_protocol
- Pseudocode style: cluster replicas keep a replicated state using a consensus protocol (e.g., Raft). Use when describing HA.
Southbound and API syntax to remember (common keywords, each on its own line):
OpenFlow messages: PACKET_IN, FLOW_MOD, PACKET_OUT, FLOW_REMOVED, PORT_STATUS, BARRIER_REQUEST, BARRIER_REPLY
REST verbs for northbound: GET, POST, PUT, DELETE (JSON payloads)
gRPC/P4Runtime: Read, Write, StreamChannel (for P4Runtime)
Worked examples
Example 1 — Reactive Packet-In flow setup (trace with numbers) Problem: A switch receives a packet that does not match any flow. Compute approximate flow-setup time to forward subsequent packets. Given: one-way latency switch->controller = 5 ms, controller processing = 3 ms, controller->switch one-way = 5 ms, switch programming time = 2 ms. Steps:
- Switch sends PACKET_IN to controller (arrives after 5 ms).
- Controller processes event and computes flow (3 ms).
- Controller sends FLOW_MOD (arrives after 5 ms).
- Switch programs table in 2 ms and forwards the buffered packet.
Formula:
T_flow_setup = d_sw_ctrl + T_proc_ctrl + d_ctrl_sw + T_prog_sw. Numbers:T_flow_setup = 5 + 3 + 5 + 2 = 15 ms. Answer: 15 ms is the time before the packet(s) can be forwarded by the new flow rule. (Note: if RTT is measured instead of one-way, adapt formula accordingly.)
Example 2 — Controller placement small numeric assignment Problem: 6 switches; candidate controller positions at two nodes. Distances (one-way ms) from switches to candidate controllers:
- To C1: [2, 4, 6, 8, 4, 6]
- To C2: [7, 3, 5, 2, 6, 4] Assign each switch to the nearer controller and compute L_avg. Steps:
- Compare per-switch distances and choose controller per switch: S1->C1 (2<7), S2->C2 (3<4), S3->C1 (5? compare: to C1=6, to C2=5 so S3->C2), etc. Do comparisons:
- S1: C1(2) vs C2(7) => C1
- S2: C1(4) vs C2(3) => C2
- S3: C1(6) vs C2(5) => C2
- S4: C1(8) vs C2(2) => C2
- S5: C1(4) vs C2(6) => C1
- S6: C1(6) vs C2(4) => C2
- Distances to assigned controllers: [2,3,5,2,4,4]
- Compute L_avg = (2+3+5+2+4+4)/6 = 20/6 = 3.333... ms. Answer: L_avg = 3.333 ms.
Example 3 — Short model answer: Why use distributed controllers? Model answer points: state scalability limits single instance (CPU, memory); single point of failure risks downtime; distribution provides parallelism for flow processing and localizes latency. Must mention trade-offs: need state replication and consensus (cost: extra latency and complexity), potential split-brain under partitions, testing of consistency model.
Common mistakes
- Forgetting replication/consensus overhead when claiming perfect linear scalability of controllers.
- Using RTT where one-way delay is required, or vice versa, without noting which convention is used.
- Omitting the time to program the switch (T_prog_sw) in flow-setup calculations.
- Assuming OpenFlow is the only southbound protocol — modern controllers support many southbound interfaces.
- Claiming that adding controllers always reduces latency without discussing placement and inter-controller synchronization costs.
For your exam
Typical question types:
- Definitions and short notes: define controller, northbound/southbound APIs, NOS, HA methods. Full marks: clear definitions, assumptions, short diagram or examples.
- Derivations and formulas: derive average latency expression for controller placement or compute T_flow_setup. Full marks: show formula, define symbols, substitute numbers with units, give final numeric answer with units.
- Long answer: discuss trade-offs of centralized vs distributed controller architectures. Full marks: explain pros/cons, give examples of state replication and consensus, mention CAP trade-offs and when to choose each.
- Diagram-based: draw sequence diagram of reactive flow installation. Full marks: include events (PACKET_IN, FLOW_MOD), show timing and where packets are buffered.
- Short programming/REST question: show example REST call to install a flow (verb, URL, JSON body) or name southbound messages. Full marks: correct verb and body structure, explanation of fields. Example: POST /api/flows with body {"match":{"ipv4_dst":"10.0.0.1/32"},"actions":[{"output":1}],"priority":100}.
What full-marks answers must include: clear definitions of terms used, units in any numeric work, step-by-step reasoning, diagrams where requested, and mention of assumptions.
Quick check
- What is the role of the northbound API of an SDN controller?
- Name two southbound protocols a modern SDN controller may use besides OpenFlow.
- In a reactive flow setup, list the four main timing components you must sum to estimate the flow-setup latency.
Answers: 1) To expose controller services to network applications (policy, topology, metrics) via REST/gRPC/SDKs. 2) NETCONF, OVSDB (also P4Runtime, PCEP, gNMI). 3) switch->controller latency, controller processing time, controller->switch latency, switch programming time.
Notes for reviewer (Aria): I have kept platform-specific implementation details minimal. Please verify the following points that I am unsure about or that need precise wording for accuracy.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?