Professional Documents
Culture Documents
Advanced Computer Networking (Acn) : In2097 - Wise 2019-2020
Advanced Computer Networking (Acn) : In2097 - Wise 2019-2020
Department of Informatics
Technical University of Munich
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
Management Plane:
Control Plane:
Management Plane:
Control Plane:
Example: Routing
Traditional architectures consist of three planes: management plane, control plane, and data plane.
A plane is a group of algorithms and network protocols
These 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
Chapter 6: Software Defined Networking – Introduction 6-9
Introduction
A more formal definition
Two requirements:
• A network in which the control plane is separate from the forwarding plane
• A single control plane controls several forwarding devices
Abstraction:
• No distributed state, one central view of the network (common model: "one big switch")
• No individual configuration, one centrally managed control plane
• Important: View centralized, controller itself may also be distributed
Gain:
• Complex, distributed protocols such as the Spanning Tree Protocol are no longer necessary
• Simpler algorithms utilizing the central view (e.g., Dijkstra)
• Less complexity in the control plane
Introduction
OpenFlow
Introduction
Core concepts
Example
NFV
P4
Acknowledgements
Bibliography
Switch X
VM1 VM3
VM2 VM4
Switch W Switch Y
Hypervisor 1 Hypervisor 2
Switch Z
Data plane
Chapter 6: Software Defined Networking – OpenFlow 6-13
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..
Figure 3: Router
Figure 4: 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
2 Switch Components
Chapter 6: Software Defined Networking – OpenFlow 6-17
An OpenFlow Logical Switch consists of one or more flow tables and a group table, which perform packet
Example
Controller
Controller
Controller
Controller
Controller
Controller
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 for-
warded 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
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 Virtual switch
+ Uses traditional OS sockets
- High load on virtual switch Figure 8: Traditional VM-based NFC
Non-virtualized NFC
• Entire NFC running directly on host system NF 1 NF 2 NF 3
• Communication between NFs via NF framework (e.g. NF framework
DPDK), initial entry and last exit via virtual switch
+ No costs for virtual switch Figure 9: Non-virtualized framework-based NFs
VM
vNIC vNIC
Performance virtual switching solutions [4]
• Investigated 4 different setups involv- Switch Switch
pNIC pNIC pNIC pNIC
ing physical/virtual pNICs/vNICs
• CPU: Intel Xeon E3-1230 V2 CPU
(3.3 GHz, base clock) (a) pNIC forwarding (b) pNIC to pNIC through VM
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
• OpenFlow offers a standardized interface to configure Control Plane
the data plane ARP IPv4
• OpenFlow only supports protocols known by the hard-
OpenFlow
ware or software used on the data plane
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 Control Plane
• OpenFlow only supports protocols known by the hard- ARP IPv4 NewP
E
ware or software used on the data plane
OpenFlow
• Introducing a new protocol (e.g., NewP) fails without
support from the data plane Data Plane
ARP IPv4
OpenFlow
• OpenFlow allows programmability on the control plane
• OpenFlow offers a standardized interface to configure
the data plane Management Plane
• OpenFlow only supports protocols known by the hard-
CLI
ware or software used on the data plane
P4 (Programming Protocol-Independent Packet Processors)
• P4 is a domain specific programming language to pro- Control Plane
gram data plane devices
ARP IPv4 NewP
• P4 allows programming switches to support entirely new
protocols (e.g., NewP) OpenFlow
OpenFlow vs. P4
P4 Data Plane
• P4 is not a successor or a replacement of OpenFlow
ARP IPv4 NewP
• OpenFlow and P4 solve specific tasks on separate
planes
• P4 can be used to implement a OpenFlow-capable ap-
plications 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
T4 P4 S (called tapas)
NetFPGA
• fully programmable NIC (down to
the physical layer)
• utilizing hardware description lan-
guages such as Verilog or VHDL
• Xilinx Virtex 7 FPGA
• up to 4 × 10 Gbit/s interfaces (via
SFP+ transceivers)
Barefoot Tofino
• Tofino ASIC: specifically designed switching
ASIC with native P4 support
• capable of up to 6.5 Tbit/s throughput (unidirec-
tional)
• for comparison: peak traffic at biggest Internet
exchange DE-CIX in Frankfurt was 6.74 Tbit/s in
2018
• up to 64 × 100 Gbit/s interfaces (via QSFP28
transceivers) 32 / 64-port switch [source: arista.com]
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 X
• Flexibility: Enable the implementation of various protocols : accomplished X
• 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
Note: the following slides are based on the P4 tutorial from P4.org
Traffic
Manager
Traffic
Manager
Figure 18: P4 model architecture without traffic manager and egress stages
open-nfp.org]
Tasks
• Intrinsic metadata:
• Additional target-specific metadata provided for every packet
• e.g. receive_timestamp
• User-defined metadata
• Data created by the P4 program during runtime for every packet
• e.g. new_tunnel_id
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 ;)
b i t <8> protocol ;
IPv4 header
b i t <16> hdrChecksum ;
ip4Addr_t srcAddr ;
ip4Addr_t dstAddr ;
}
Chapter 6: Software Defined Networking – P4 6-52
P4 example: IPv4 router
Metadata definition
/* Architecture */
s t r u c t standard_metadata_t { struct defines a unsorted collection of members
b i t <9> i n g r e s s _ p o r t ;
b i t <9> egress_spec ;
b i t <9> e g r e s s _ p o r t ;
b i t <32> clone_spec ;
b i t <32> i n s t a n c e _ t y p e ;
b i t <1> drop ;
b i t <16> r e c i r c u l a t e _ p o r t ;
b i t <32> p a c k e t _ l e n g t h ;
...
}
/ * User program * /
s t r u c t metadata {
...
}
s t r u c t headers {
ethernet_t ethernet ;
ipv4_t ipv4 ;
}
r states maystates
• Additional be may
defined bythethe
be defined by program-
mer
rammer
• Each state may execute statements and then
ch state, execute
transition zero or more
to another state
state start {
t r a n s i t i o n parse_ethernet ; std_meta std_meta
}
state parse_ethernet {
packet . e x t r a c t ( hdr . e t h e r n e t ) ;
t r a n s i t i o n s e l e c t ( hdr . e t h e r n e t . ethType ) {
TYPE_IPV4 : pa r s e _ i p v 4 ; / / 0x800 select works similar to case
d e f a u l t : accept ; statements in Java/C
} select ends after successful match
} (default is not executed afer
successful TYPE_IPV4 match)
s t a t e p a r s e_ i p v 4 {
packet . e x t r a c t ( hdr . i p v 4 ) ;
extract set header and its fields to
t r a n s i t i o n accept ;
valid
}
}
Chapter 6: Software Defined Networking – P4 6-55
P4 example: IPv4 router
Ingress and table definition
c o n t r o l MyIngress ( i n o u t headers hdr , A control block contains the
i n o u t metadata meta , functionality of the program
i n o u t standard_metadata_t std_meta ) {
a c t i o n drop ( ) { mark_to_drop ( ) ; } Control blocks can represent
different kinds of processing:
a c t i o n i p v 4 _ f o r w a r d ( macAddr_t dstAddr , egressSpec_t • Match-Action pipelines
port ) { • Deparsers
standard_metadata . egress_spec = p o r t ;
• Additional forms of pro-
hdr . e t h e r n e t . srcAddr = hdr . e t h e r n e t . dstAddr ;
hdr . e t h e r n e t . dstAddr = dstAddr ; cessing (checksums)
hdr . i p v 4 . t t l = hdr . i p v 4 . t t l − 1 ;
} Typically headers and metadata
act as interfaces between control
t a b l e ipv4_lpm { blocks
key = { hdr . i p v 4 . dstAddr : lpm ; }
a c t i o n s = { i p v 4 _ f o r w a r d ; drop ; NoAction ; } Execution starts with apply()
s i z e = 1024; statement
d e f a u l t _ a c t i o n = NoAction ( ) ;
}
apply {
i f ( hdr . i p v 4 . i s V a l i d ( ) ) { ipv4_lpm . a p p l y ( ) ; }
}
}
Chapter 6: Software Defined Networking – P4 6-56
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 ;
Chapter 6: Software Defined Networking – P4 6-60
Active area of research
• P4 benchmarking
• P4 extensions
• ...
Introduction
OpenFlow
NFV
P4
Acknowledgements
Bibliography
Introduction
OpenFlow
NFV
P4
Acknowledgements
Bibliography
[1] Open Networking Foundation. „Openflow switch specification, version 1.0.0“. In: (2009).
[2] Open Networking Foundation. „Openflow switch specification, version 1.6“. In: (2016).
[3] ESI. Network Function Virtualisation. last accessed: 2019-11-24. 2012. URL:
https://www.etsi.org/technologies/nfv.
[4] Paul Emmerich et al. „Throughput and Latency of Virtual Switching with Open vSwitch: A Quantitative
Analysis“. In: (July 2017). DOI: 10.1007/s10922-017-9417-0.