09 Software Defined Networks
09 Software Defined Networks
Introduction
OpenFlow
Introduction
Core concepts
Example
NFV
P4
Motivation
P4 targets
P4 Core
P4 example: IPv4 router
Active area of research
Acknowledgements
Bibliography
Introduction
OpenFlow
NFV
P4
Acknowledgements
Bibliography
Management
configure
Plane
decide
e.g. spanning e.g. spanning
tree protocol tree protocol
Control Plane
forwarding table
updates
forwarding table
forwarding table
lookups Data Plane:
per-packet
processing
incoming frame outgoing frame
forwarding
Control Plane:
Control Plane:
• management plane,
• control plane,
• and data plane.
What is a plane?
A plane is a group of algorithms and network protocols.
These protocols and algorithms
What is SDN?
• Historically, devices include both, the control plane and the data plane
• SDN has one central control plane, which manages all the data planes of all the switches
Switch X
VM1 VM3
VM2 VM4
Switch W Switch Y
Hypervisor 1 Hypervisor 2
Switch Z
Control plane
Switch X
VM1 VM3
VM2 VM4
Switch W Switch Y
Hypervisor 1 Hypervisor 2
Switch Z
Data plane
• A network in which the control plane is separate from the data plane
• A single control plane controls several forwarding devices
Abstraction:
Gain:
• Complex, distributed protocols such as the Spanning Tree Protocol (STP) are no longer necessary
• Simpler algorithms utilizing the central view (e.g., Dijkstra’s algorithm instead of STP)
• Less complexity in the control plane
Introduction
OpenFlow
Introduction
Core concepts
Example
NFV
P4
Acknowledgements
Bibliography
tion (ONF)
• Version 1.0 was released in 2009 [1]
Switch W Switch Y
• Latest version 1.6 from 2016 [2] Hypervisor 1 Hypervisor 2
Switch Z
Data plane
Software Defined Networking — OpenFlow 14
Core concepts
OpenFlow tables
Data(plane(abstraction:(Flow(table
OpenFlow is based on the match+action principle
Bytes(+(packets
1. Forward((one(or(more(ports)
2. Drop
3. Encapsulate(and(send(to(controller
4. Header( rewrite
5. Push/pop(MPLS(label(/(VLAN(tag
6. Queues( +(bitrate(limiter((bit/s)
7. Etc..
Table 2: Router
Table 3: Firewall
Traditional classification
• Switch:
• Works on Layer 2
• Simple forwarding of packets
• Router:
• Works on Layer 3
• Finding out where to route packets (LPM)
• Clear distinction (e.g. switch, router) no longer possible as functionality is determined by software
• These boxes/switches can even be used as firewall, tunnel gateways
Controller Controller
Protocol
OpenFlow Switch
Datapath
OpenFlow OpenFlow
Channel Channel Group Meter
Control Channel Table Table
Port Port
Flow Flow Flow
Table Table Table
Port Port
Pipeline
VM VM VM VM
...
vNIC vNIC vNIC vNIC vNIC
Software Switch
pNIC pNIC pNIC
Physical Switches & Crosslink Connections
Controller
• Controller can also install rule on switch to make forwarding more efficient
• IPv4 packets (matching ethertype 0x0800 destination address 10.0.0.2) from Client 1 get directly forwarded to Client 2
OpenFlow
Introduction
OpenFlow
NFV
P4
Acknowledgements
Bibliography
• (V)NF: (Virtualized) Network Function, (virtualized) building block performing a network task
• NFC: Network Function Chaining, putting together several network functions to create more complex packet processing chains
VM 1 VM 2 VM 3
NF 1 NF 2 NF 3
Figure 5: Example of a chain of Virtual Network Functions
Traditional approach VM 1 VM 2 VM 3
• One VM per NF NF 1 NF 2 NF 3
• Communication between NFs via virtual switch
+ Strong isolation between NFs
+ Uses traditional OS sockets Virtual switch
- High load on virtual switch
Non-virtualized NFC
• Entire NFC running directly on host system
NF 1 NF 2 NF 3
• Communication between NFs via NF framework (e.g. DPDK), initial
entry and last exit via virtual switch NF framework
+ No costs for virtual switch
- NFs need to be rewritten to use NF framework Figure 7: Non-virtualized framework-based NFs
vNIC vNIC
Performance of virtual switching solutions [3]
• Investigated 4 different setups involving physi- Switch Switch
cal/virtual pNICs/vNICs
pNIC pNIC pNIC pNIC
• CPU: Intel Xeon E3-1230 V2 CPU (3.3 GHz, base
clock)
(a) pNIC forwarding (b) pNIC to pNIC through VM
• pNIC: 10 Gbit/s Intel X540
• SW: GRML Linux kernel v3.7, Open vSwich v2.0, VM VM VM
DPDK vSwitch v0.1
• Hypervisor: qemu-kvm 1.1.2
• Worst case measurement scenario: minimum-
vNIC vNIC vNIC vNIC
sized packets 64 B (14.88 Million packets per sec-
ond (Mpps) @ 10 Gbit/s)
Switch Switch
pNIC pNIC
Performance + ++ +++
Isolation +++ ++ +
Chaining interface OS sockets Framework-based Framework-based
• Performance requirements
• Integration of legacy NF supporting only socket interface
• Integration of NFs from different vendors
• Stronger isolation requirements for untrusted customer code
Introduction
OpenFlow
NFV
P4
Motivation
P4 targets
P4 Core
P4 example: IPv4 router
Active area of research
Acknowledgements
Bibliography
Management Plane
CLI
OpenFlow
• OpenFlow allows programmability on the control plane Control Plane
• OpenFlow offers a standardized interface to configure the data plane
• OpenFlow only supports protocols known by the hardware or software
ARP IPv4
used on the data plane
OpenFlow
Data Plane
ARP IPv4
Management Plane
CLI
OpenFlow
• OpenFlow allows programmability on the control plane
• OpenFlow offers a standardized interface to configure the data plane Control Plane
• OpenFlow only supports protocols known by the hardware or software
ARP IPv4 NewP
E
used on the data plane
• Introducing a new protocol (e.g., NewP) fails without support from the
data plane
OpenFlow
Data Plane
ARP IPv4
Management Plane
OpenFlow CLI
• OpenFlow allows programmability on the control plane
• OpenFlow offers a standardized interface to configure the data plane
• OpenFlow only supports protocols known by the hardware or software
used on the data plane
Control Plane
P4 (Programming Protocol-Independent Packet Processors) ARP IPv4 NewP
• P4 is a domain specific programming language to program data plane
devices OpenFlow
• P4 allows programming switches to support entirely new protocols (e.g.,
NewP) P4 Data Plane
ARP IPv4 NewP
OpenFlow
• OpenFlow allows programmability on the control plane
Management Plane
• OpenFlow offers a standardized interface to configure the data plane CLI
• OpenFlow only supports protocols known by the hardware or software
used on the data plane
P4 (Programming Protocol-Independent Packet Processors)
• P4 is a domain specific programming language to program data plane
Control Plane
devices ARP IPv4 NewP
• P4 allows programming switches to support entirely new protocols (e.g.,
NewP)
OpenFlow
OpenFlow vs. P4
• P4 is not a successor or a replacement of OpenFlow P4 Data Plane
• OpenFlow and P4 solve specific tasks on separate planes
ARP IPv4 NewP
• P4 can be used to implement OpenFlow-capable applications for switches
• Control and customization: make the device behave exactly as you want, operators can hide internal protocols
• Reliability: include only the features you need
• Efficiency: reduce energy consumption and expand scale by doing only what you need
• Update: Add new features when you want
• Telemetry: See inside the data plane
• Exclusivity: Program your own features without the need for involving a chip vendor
• Rapid Prototyping: enables fast deployment of protocols for prototyping
• Fast Development Cycles: enables software upgrades for protocols
• Control and customization: make the device behave exactly as you want, operators can hide internal protocols
• Reliability: include only the features you need
• Efficiency: reduce energy consumption and expand scale by doing only what you need
• Update: Add new features when you want
• Telemetry: See inside the data plane
• Exclusivity: Program your own features without the need for involving a chip vendor
• Rapid Prototyping: enables fast deployment of protocols for prototyping
• Fast Development Cycles: enables software upgrades for protocols
Challenges:
p4c/bmv2
• open source, available at https://p4.org/code/
• "official" P4 reference implementation developed by p4.org
• used for teaching, testing, trying out new features
• no specific hardware required (mininet) P4TC
• slow, not optimized for performance • open source, available at https://www.p4tc.dev/
• ongoing effort to bring P4 to the Linux kernel
• based on existing Linux modules (traffic control/TC)
T4 P4 S (called tapas) • bringing P4 to end hosts
• open source, available at http://p4.elte.hu/
• compiles P4 for DPDK
• requires DPDK-compatible hardware
• decent performance (>10 Gbit/s)
P4 targets
Network Processor Unit (NPU)
Accelerators
Arm11 Core
Crypto Load Balancer Atomic Adaptive Memory
256K L2 Cache Controller
Look-up Queue Bulk
64K I Cache (2x32bit DDR3)
64K D Cache Statistics CAM Hash
NetFPGA
• fully programmable NIC (down to the physical
layer)
• utilizing hardware description languages
such as Verilog or VHDL
• Xilinx Virtex 7 FPGA
• up to 4 × 10 Gbit/s interfaces (via SFP+
transceivers)
Barefoot Tofino 2
• Tofino ASIC: specifically designed switching ASIC with native
P4 support
• capable of up to 12 Tbit/s throughput (unidirectional)
• for comparison: peak traffic at biggest Internet exchange DE-
CIX in Frankfurt was 15 Tbit/s in 2023a
• up to 64 × 200 Gbit/s interfaces (via QSFP56 transceivers)
a https://www.de-cix.net/en/about-de-cix/media/press-releases/europes-largest-internet-exchange-de-cix-frankfurt-sets-new-traffic-record-15-terabits-per-second,
last accessed 2023-01-03
Performance + ++ ++ +++
Flexibility +++ ++ ++ +
Ease of use +++ + + +
Costs 0C > 500 C > 1000 C > 10 000 C
Performance + ++ ++ +++
Flexibility +++ ++ ++ +
Ease of use +++ + + +
Costs 0C > 500 C > 1000 C > 10 000 C
• Performance: data planes need to process millions of packets per second : accomplished ✓
• Flexibility: Enable the implementation of various protocols : accomplished ✓
• Hardware independence: keep the description high-level enough : development ongoing . . .
• Basic P4 functionality can be realized on any target
• Every target offers different additional capabilities not programmed in P4 (e.g. multicast support)
• These additional functionalities make P4 programs hardware dependent
Operators/
End Users
Systems
Targets
Solutions/
Services
Academia/
Research
• Open source, evolving, domain-specific language • Membership is free: contributions are welcome
• Permissive Apache license, code on GitHub today
Copyright • – P4.org
© 2017 Independent,
set up as a California nonprofit
Software Defined Networking — P4 43
P4 Core
P4 versions
Two versions available:
P4 Language Tutorial
Note: the following slides are based on the P4 tutorial from P4.org
Traffic
Manager
Traffic
Manager
Figure 14: P4 model architecture without traffic manager and egress stages
Tasks
[0] encap ingress_port exact port_0 encapsulate_act vlantag = 123 Example table
[1] default drop
Tasks
Tasks
Extern objects
• New in P416
• Externs perform additional tasks which are either not written in or not supported by P4
• Architecture specific:
• Software/NPU targets: extension via programmed functions (C, Python, . . . )
• FPGA: extension via VHDL/Verilog-defined functions
• ASIC: no extension possible
Goal:
Common capabilities
• Metadata definitions
• Hashes and checksums (only simple hashes e.g. CRC, no cryptographic hashes such as SHA)
• Counters and meters
• Registers
• Random number generators
• Access to timestamps
Disclaimer
• Basic P4 example
• Essential features are missing, no ARP/ICMP/VLAN/IPv6 handling
→ do not use this router for the project ;)
header e t h e r n e t _ t {
header declares a new header. The following operations can be called on a
macAddr_t dstAddr ;
header: isValid(), setValid(), and setInvalid().
macAddr_t srcAddr ;
b i t <16> ethpersType ;
}
header e t h e r n e t _ t {
header declares a new header. The following operations can be called on a
macAddr_t dstAddr ;
header: isValid(), setValid(), and setInvalid().
macAddr_t srcAddr ;
b i t <16> ethpersType ;
What about the frame check sequence?
}
header e t h e r n e t _ t {
header declares a new header. The following operations can be called on a
macAddr_t dstAddr ;
header: isValid(), setValid(), and setInvalid().
macAddr_t srcAddr ;
b i t <16> ethpersType ;
What about the frame check sequence?
}
→ Checked and added automatically
header e t h e r n e t _ t {
header declares a new header. The following operations can be called on a
macAddr_t dstAddr ;
header: isValid(), setValid(), and setInvalid().
macAddr_t srcAddr ;
b i t <16> ethpersType ;
What about the frame check sequence?
}
→ Checked and added automatically
header i p v 4 _ t {
b i t <4> version ;
b i t <4> ihl ;
b i t <8> diffserv ; Offset 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
/ * User program * /
s t r u c t metadata {
...
}
s t r u c t headers {
ethernet_t ethernet ;
ipv4_t ipv4 ;
}
Software Defined Networking — P4 55
P4 Parsers
P4 example: IPv4 router
16
P416 Parsers
◦ reject
• accept
• reject
•• Other
Additional states may
states may be definedbe defined
by the programmer by the
• programmer
Each state may execute statements and then transition to an-
other state
•• In each state, execute zero or more
Loops are allowed
statements, and then transition to
accept reject
another state (loops are OK)
apply {
i f ( hdr . i p v 4 . i s V a l i d ( ) ) { ipv4_lpm . a p p l y ( ) ; }
}
} Software Defined Networking — P4 58
P4 example: IPv4 router
IPv4 Table example
/ / no e x p l i c i t deparser o b j e c t => c o n t r o l
c o n t r o l MyDeparser ( p a ck e t_ o u t packet , i n headers hdr ) {
apply {
packet . e m i t ( hdr . e t h e r n e t ) ;
packet . e m i t ( hdr . i p v 4 ) ;
}
}
Router (
MyParser ( ) ,
MyVerifyChecksum ( ) ,
MyIngress ( ) ,
MyEgress ( ) ,
MyComputeChecksum ( ) ,
MyDeparser ( )
) main ;
• P4 benchmarking
• P4 extensions
• ...
Introduction
OpenFlow
NFV
P4
Acknowledgements
Bibliography
Introduction
OpenFlow
NFV
P4
Acknowledgements
Bibliography
[3] P. Emmerich, D. Raumer, S. Gallenmüller, F. Wohlfart, and G. Carle, “Throughput and Latency of Virtual Switching with Open vSwitch:
A Quantitative Analysis,” in Journal of Network and Systems Management, Jul. 2017. DOI: 10.1007/s10922-017-9417-0.
[4] ESI, Network function virtualisation, last accessed: 2019-11-24, 2012. [Online]. Available: https://www.etsi.org/technologies/nfv.