Performance evaluation of�ONOS support for P4Runtime
Proposed activity for the Sec&Perf brigade
Carmelo Cascone
MTS, ONF�
June 17, 2019�ONF Sec&Perf Workshop @ TMA 2019
Outline
2
P4 - Data plane pipeline programming language
ASIC, FPGA, NPU, or CPU
Packets
Pipeline of match-action tables,
programmable or fixed-function
Table {
match
actions
}
Compiler (provided by switch vendor)
mypipeline.p4
Copyright © 2019 - Open Networking Foundation
P4 workflow summary
4
P4 Program
P4 Architecture
Model
P4 Compiler
Target-specific configuration binary
Control Plane
Data Plane
Tables
Extern
objects
Load
Vendor supplied
User supplied
Add/remove�table entries
CPU port
Packet-in/out
Extern�control
P4Runtime
Slide courtesy P4.org
Copyright © 2019 - Open Networking Foundation
P4Runtime v1.0
Copyright © 2019 - Open Networking Foundation
P4Runtime overview
6
P4Runtime client�(control plane)
p4runtime.proto (API)
P4Runtime server
(e.g. Stratum)
Target driver
P4 target
Copyright © 2019 - Open Networking Foundation
P4Runtime main features
Copyright © 2019 - Open Networking Foundation
P4 compiler outputs
8
test.p4
test.bin
Control plane
p4runtime.proto
P4Runtime server
Target driver
Switch ASIC
p4c�(compiler)
test.p4info
Full P4Info protobuf specification:
https://github.com/p4lang/p4runtime/blob/master/proto/p4/config/v1/p4info.proto
Copyright © 2019 - Open Networking Foundation
P4Info example
9
...
action ipv4_forward(bit<48> dstAddr,
bit<9> port) {
eth.dstAddr = dstAddr;
metadata.egress_spec = port;
ipv4.ttl = ipv4.ttl - 1;
}
...
�table ipv4_lpm {
key = {
hdr.ipv4.dstAddr: lpm;
}
actions = {
ipv4_forward;
...
}
...
}
basic_router.p4
actions {
id: 16786453
name: "ipv4_forward"
params {
id: 1
name: "dstAddr"
bitwidth: 48
...
id: 2
name: "port"
bitwidth: 9
}
}
...
tables {
id: 33581985
name: "ipv4_lpm"
match_fields {
id: 1
name: "hdr.ipv4.dstAddr"
bitwidth: 32
match_type: LPM
}
action_ref_id: 16786453
}
basic_router.p4info
P4 compiler
Copyright © 2019 - Open Networking Foundation
P4Runtime table entry WriteRequest example
10
device_id: 1
election_id { … }
updates {
type: INSERT
entity {
table_entry {
table_id: 33581985
match {
field_id: 1
lpm {
value: "\n\000\001\001"
prefix_len: 32
}
}
action {
action_id: 16786453
params {
param_id: 1
value: "\000\000\000\000\000\n"
}
params {
param_id: 2
value: "\000\007"
…
action ipv4_forward(bit<48> dstAddr,
bit<9> port) {
/* Action implementation */
}�table ipv4_lpm {
key = {
hdr.ipv4.dstAddr: lpm;
}
actions = {
ipv4_forward;
...
}
...
}
hdr.ipv4.dstAddr=10.0.1.1/32� -> ipv4_forward(00:00:00:00:00:10, 7)
basic_router.p4
Logical view of table entry
WriteRequest message (protobuf text format)
Control plane�generates
Copyright © 2019 - Open Networking Foundation
An aside on Stratum and fixed-function switches...
Copyright © 2019 - Open Networking Foundation
Role of P4 for fixed-function chips
ASIC 1
ASIC 2
Logical
Physical
Control
Mapping
Manual or via compiler
Slide courtesy: Google
Copyright © 2019 - Open Networking Foundation
Project Stratum (ONF)
Copyright © 2019 - Open Networking Foundation
Stratum High-level Architectural Components
kernel
hardware
user
Common (HW agnostic)
Chip specific
Platform specific
Chip and Platform specific
P4Runtime
gNMI
gNOI
Switch Broker Interface
Table Manager
Node/Chip Manager
Chassis Manager
Chip Abstraction Managers
E.g. ACL, L2, L3, Packet I/O, Tunnel
Platform Manager
Remote or Local Controller(s)
Switch SDK
Platform API
Switch Chip Drivers
Platform Drivers
Switch Chip(s)
Peripheral(s)
Current support for
Stratum switch agent
ONLP
Copyright © 2019 - Open Networking Foundation
ONOS support for P4Runtime
Copyright © 2019 - Open Networking Foundation
Design goals
ONOS originally designed to work with OpenFlow and fixed-function switches
Extended it to:
Copyright © 2019 - Open Networking Foundation
Pipeconf - Bring your own pipeline!
17
pipeconf.oar
Copyright © 2019 - Open Networking Foundation
Pipeconf support in ONOS
18
Pipeline-agnostic�App
Device with Stratum (BF Tofino, BRCM Tomahawk, BMv2, etc.)
Pipeline-specific�FlowRules, Groups, Meters, etc
Translation services�Uses pipeconf drivers
Protocol
Core
Events�(packet, topology, etc.)
P4Runtime
Pipeline-aware�App
Pipeconf Store
Pipeconf
(.oar)
FlowObjectives
gRPC�Deploy P4 program, table management,
config, operations
ONOS
Drivers
Stratum
gNMI
gNOI
PI Framework
PI framework (@beta)
19
onos/core/api/.../pi/model
DefaultPiPipeconf.java
PiActionId.java
PiActionModel.java
PiActionParamId.java
PiActionParamModel.java
PiActionProfileId.java
PiActionProfileModel.java
PiControlMetadataId.java
PiControlMetadataModel.java
PiCounterId.java
PiCounterModel.java
PiCounterType.java
PiData.java
PiMatchFieldId.java
PiMatchFieldModel.java
PiMatchType.java
PiMeterId.java
PiMeterModel.java
PiMeterType.java
...
onos/core/api/.../pi/service
PiFlowRuleTranslationStore.java
PiFlowRuleTranslator.java
PiGroupTranslationStore.java
PiGroupTranslator.java
PiMeterTranslationStore.java
PiMeterTranslator.java
PiMulticastGroupTranslationStore.java
PiMulticastGroupTranslator.java
PiPipeconfConfig.java
PiPipeconfDeviceMappingEvent.java
PiPipeconfMappingStore.java
PiPipeconfMappingStoreDelegate.java
PiPipeconfService.java
PiPipeconfWatchdogEvent.java
PiPipeconfWatchdogListener.java
PiPipeconfWatchdogService.java
PiTranslatable.java
PiTranslatedEntity.java
PiTranslationEvent.java
...
onos/core/api/.../pi/runtime
PiAction.java
PiActionGroup.java
PiActionGroupHandle.java
PiActionGroupId.java
PiActionGroupMember.java
PiActionGroupMemberHandle.java
PiActionGroupMemberId.java
PiActionParam.java
PiControlMetadata.java
PiCounterCell.java
PiCounterCellData.java
PiCounterCellId.java
PiEntity.java
PiEntityType.java
PiExactFieldMatch.java
PiFieldMatch.java
PiGroupKey.java
PiHandle.java
PiLpmFieldMatch.java
...
Translation Service
20
Translation service
with validation�(based on P4Info-derived pipeline model)
FlowRule
Group
Meter
PiTableEntry
PiActionGroup�PiMulticastGroupEntry
PiMeterCellConfig
Pipeconf
Flow operations
21
Translation Service
P4Runtime Client
Pipeliner
Pipeline-agnostic�App
Flow Objective Serv.
P4Runtime
FlowRuleProgrammable
Pipeconf-based 3-phase translation:�
1. Flow Objective → Flow Rule
2. Flow Rule → Table entry
3. Table Entry → P4Runtime message
Flow Rules�(many)
Table Entry
Pipeline Interpreter
ONOS Core
Device/protocol driver
Pipeconf
Pipeline-aware App
Flow Rule Serv.
Flow Objective
P4Runtime protobuf messages
P4Info
PipelineInterpreter (driver behavior)
22
P4Runtime support in ONOS 2.1
23
P4Runtime control entity | ONOS API |
Table entry | Flow Rule Service, Flow Objective Service Intent Service |
Packet-in/out | Packet Service |
Action profile group/members, PRE multicast groups, clone sessions | Group Service |
Meter | Meter Service (indirect meters only) |
Counters | Flow Rule Service (direct counters) P4Runtime Client (indirect counters) |
Pipeline Config | Pipeconf |
Unsupported features - community help needed!�Parser value sets, registers, digests
ONOS+P4 workflow recap
24
Performance considerations
Copyright © 2019 - Open Networking Foundation
Performance overhead
26
FlowRule
(ONOS class)
PiTableEntry
(ONOS class)
P4Runtime.TableEntry (protobuf message)
Translation
via PipelineInterpreter
Encoding
via P4info
Translation store (KV)
FlowRule
(ONOS class)
PiTableEntry
(ONOS class)
P4Runtime.TableEntry (protobuf message)
Lookup
Decoding
via P4info
Translation store (KV)
Write
Read
Apps
Switch
Apps
Switch
Write
Relevant use cases and metrics
27
Proposed testing methodology
28
Conclusions
29
Get started: ONOS+P4 tutorial
Copyright © 2019 - Open Networking Foundation
Thanks!
31