SDN & network automation concepts
Explain control and data plane separation and how networks are configured as code.
By Invicly Tech, , in Computer Networking. About 10 minutes to read.
In short
Software-defined networking separates the control plane, which decides where traffic should go, from the data plane, which forwards packets. A central controller programs many devices through APIs, so the network can be managed as one system and configured as code. Cloud VPCs are SDN in practice.
Explained simply
Every router and switch does two jobs. First it thinks: it talks to its neighbours and decides which way each destination should go. That is the control plane. Then it works: it moves each packet out of the right port, millions of times a second. That is the data plane.
In a traditional network, every device does its own thinking, and engineers configure each one by hand, box by box. With a hundred switches, that means a hundred chances for a typo, and nobody has a full picture of the network.
Software-defined networking (SDN) moves much of the thinking to central software called a controller. The controller sees the whole network and tells each device what to do through an API. The devices mostly just forward packets.
Even without a full SDN controller, the same idea changes daily work. Engineers now describe the network in files, keep those files in Git, review changes like code, and let tools such as Ansible push the configuration to every device the same way.
Press Play on a diagram to walk through it one step at a time.
- 1Applications and intent
Policies such as isolate tenant A.
- 2Northbound API
REST APIs for automation.
- 3SDN controller
Global view; computes forwarding state.
- 4Southbound API
OpenFlow, NETCONF, gNMI.
- 5Data plane
Switches and virtual switches forward packets.
- 1Edit variables
Add VLAN 40 in a YAML file
- 2Pull request
Colleague reviews the diff
- 3CI checks
Lint, then a dry run with --check --diff
- 4Merge and apply
Pipeline runs the playbook
- 5Verify
Tests confirm VLAN and reachability
- 6Roll back if needed
Revert the commit and re-run
In depth
Control, data and management planes
The data plane forwards packets: it looks up the destination in a forwarding table and sends the packet out, often in specialised chips (ASICs) at line rate. The control plane builds that table: routing protocols like OSPF and BGP, ARP and spanning tree run here, on the device's CPU. The management plane is how humans and tools configure and monitor the device: SSH, SNMP, NETCONF, APIs and syslog.
In classic networks, all three live in every box, and the control plane is distributed: each router computes routes on its own from what its neighbours tell it. This is robust, since no single brain can fail, but it is hard to apply a consistent policy everywhere. SDN centralises the control plane, logically if not physically, so one system knows the full topology and computes forwarding state for all devices. Cloud VPCs are a large SDN: when you add a route in the console, a controller programs the virtual switches on thousands of hosts.
- Each device runs its own control plane
- Configured box by box, often by CLI
- No single global view
- Robust, but policy drifts
- Central controller computes state
- Devices programmed via APIs
- Global view of topology and policy
- Controller must be highly available
Controllers and OpenFlow
OpenFlow was the first widely known SDN protocol. A switch keeps flow tables; each entry has match fields (such as input port, MAC addresses, VLAN, IP addresses, TCP ports), a priority, counters and instructions like forward to port 3, drop, or send to the controller. The switch connects to the controller over TCP, usually port 6653, often protected with TLS.
When a packet matches no entry, the switch can send it to the controller in a packet-in message. The controller decides what to do, installs a rule with a flow-mod message so later packets are handled in hardware, and may send the first packet back with packet-out. Open-source controllers include ONOS and OpenDaylight. In practice, pure OpenFlow found its strongest use in research, campus experiments and some large operators; most enterprise and data centre SDN today uses vendor controllers and protocols like NETCONF, gNMI and BGP EVPN, while virtual switches such as Open vSwitch still support OpenFlow.
- Host A to Switch: First packet to host B1First packet to host B
- Switch to Controller: packet-in: no matching flow2packet-in: no matching flow
- Controller to Switch: flow-mod: match dst B, output port 73flow-mod: match dst B, output port 7
- Controller to Switch: packet-out: send the first packet4packet-out: send the first packet
- Host A to Switch: Next packets match in hardware5Next packets match in hardware
Intent-based networking
Intent-based networking raises the level further. Instead of writing device commands, you state the outcome you want, such as "guests may reach only the internet" or "the payment app must never share a segment with the guest network". The system then translates that intent into configuration for each device, applies it, and keeps checking that the live network still matches the intent.
The loop has three parts: translation (intent to policy to device config), activation (pushing the config) and assurance (collecting telemetry and verifying the result, raising an alert or fixing drift when reality differs). Commercial examples include Cisco Catalyst Center (formerly DNA Center) and Juniper Apstra. The value is consistency and continuous verification; the risk is that the translation layer is complex, so teams still need to understand what is pushed underneath.
- 1Declare intent
Guests reach only the internet
- 2Translate
Turn intent into policies and device config
- 3Activate
Push config to switches, routers, firewalls
- 4Assure
Collect telemetry; compare reality with intent
- 5Remediate
Alert or fix drift, then keep checking
- Back to step 1
Automation with APIs and Ansible
Network automation does not require an SDN controller. Modern devices offer model-driven APIs: NETCONF runs over SSH on TCP port 830 and exchanges XML; RESTCONF offers the same data over HTTPS; gNMI uses gRPC and is popular for streaming telemetry. All describe configuration and state with YANG data models, so tools work with structured data instead of screen-scraping CLI text.
Ansible is the most common entry point. It is agentless: it connects over SSH or an API, so nothing is installed on switches. Inventory files list devices and set ansible_network_os (for example cisco.ios.ios) and ansible_connection (ansible.netcommon.network_cli for CLI over SSH, or ansible.netcommon.netconf). Resource modules like cisco.ios.ios_vlans and ios_interfaces take structured data and a state such as merged, replaced or overridden. Run with --check --diff first to see changes without applying them, and keep playbooks and variables in Git so every change is reviewed.
- NETCONF: TCP 830 over SSH, XML
- RESTCONF: HTTPS with JSON or XML
- gNMI: gRPC, streaming telemetry
- ansible-playbook --check --diff previews changes
Learn it in 4 short steps
About 30m each. Track them with a timer in your plan.
- 1Separate control and data planes~30m
- 2Explain controllers and OpenFlow~30m
- 3Explain intent-based networking~30m
- 4Automate configs with APIs and Ansible~30m
Key points
- Control plane: routing decisions. Data plane: per-packet forwarding.
- Centralised control gives a global view and consistent policy.
- Network automation uses Ansible, APIs and version-controlled configs.
- Intent-based networking states the desired outcome, not device commands.
Key terms
Tap a card to flip it. 0/4 known
Examples
# Ansible task pushing a VLAN to Cisco switches
- name: Ensure VLAN 30 exists
cisco.ios.ios_vlans:
config:
- vlan_id: 30
name: VOICE
state: mergedPushing VLANs to every access switch with Ansible
A new Voice VLAN must exist on 40 access switches. Step 1: define the switches in an inventory group with the network OS and connection type. Step 2: write a playbook using the ios_vlans resource module with state merged, so existing VLANs stay untouched. Step 3: run with --check --diff to see what would change. Step 4: run it for real, then re-run to confirm it reports no changes (idempotence).
# inventory.yml
access_switches:
hosts:
sw[01:40].office.example.com:
vars:
ansible_network_os: cisco.ios.ios
ansible_connection: ansible.netcommon.network_cli
# vlans.yml
- hosts: access_switches
gather_facts: false
tasks:
- cisco.ios.ios_vlans:
config: [{ vlan_id: 30, name: VOICE }]
state: mergedReading device state with RESTCONF
You want the interface list from a router as structured JSON instead of parsing show output. Step 1: enable RESTCONF on the device (on Cisco IOS XE, the restconf command plus an HTTPS server). Step 2: request the ietf-interfaces YANG model over HTTPS with the right Accept header. Step 3: process the JSON with jq. The same data path works for changes with PUT or PATCH, which is how many controllers and scripts talk to devices.
curl -sk -u admin:"$PASS" \
-H 'Accept: application/yang-data+json' \
https://10.0.99.1/restconf/data/ietf-interfaces:interfaces \
| jq '."ietf-interfaces:interfaces".interface[] | {name, enabled}'Quick reference
- Data plane forwards packets; control plane builds tables; management plane configures
- OpenFlow: match, priority, counters, actions; controller usually on TCP 6653
- packet-in: switch asks controller; flow-mod: controller installs a rule
- NETCONF on TCP 830 (SSH), RESTCONF over HTTPS, gNMI over gRPC; all use YANG
- Ansible is agentless: set ansible_network_os and ansible_connection per group
- Resource module states: merged adds, replaced swaps per item, overridden replaces all
- Always run ansible-playbook --check --diff before applying network changes
- Intent-based loop: translate, activate, assure, remediate
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
For each item, say whether it belongs to the control, data or management plane: an OSPF hello, forwarding a video packet, an SSH login to a switch, an ARP reply, an SNMP poll.
- Exercise 2medium
Write an Ansible playbook that sets the description of interface GigabitEthernet0/1 on all access switches to "Uplink to core" and makes sure it is enabled.
- Exercise 3hard
Design a Git-based workflow for network changes with review, a dry run, automatic deploy and rollback. List the pipeline stages and what each must check.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Is SDN the same as network automation?
- No. SDN is an architecture where a controller holds the control logic. Network automation means using scripts and tools to configure devices, which you can do with or without SDN.
- Is OpenFlow still used?
- It is still supported in virtual switches like Open vSwitch and used in research and some operator networks, but most enterprise SDN today uses vendor controllers with NETCONF, gNMI, EVPN and APIs.
- Do I need to learn Python for network automation?
- It helps a lot. Ansible lets you start with YAML, but Python libraries such as Netmiko, NAPALM and ncclient cover cases Ansible modules do not.
- Is a cloud VPC an example of SDN?
- Yes. The provider's controllers program virtual switches and routers on their hosts whenever you change subnets, routes or security groups through the API.