Primarily pipeline designed based on flow objective system and applications, the pipeline includes three significant blocks: filtering, forwarding and next. These three blocks based on the flow objective system in ONOS and tables based on use case from segment routing application and other applications used by Trellis.

Figure below is the block definition of fabric.p4

(p.s. Blocks and table definition might be changed in the near future)


Packet IO ingress & egress control block

These blocks handle packet in and packet out actions.

Ingress packet io control block handles packet-out message sent by ONOS controller since a unique port number used as input port metadata, the parser and pipeline can easily understand this is a packet from the controller.

When switch/pipeline gets a packet-out message, it should set output port and bypass all tables and send to correct port directly.

For the egress packet io control block, it should handle packets-in messages. In P4, we can set a unique output port(e.g., 255 for bmv2) for packet-in action. The pipeline should send an original packet to the controller without modifying it. Currently, only ingress port information is in the metadata of packet-in message.

Filtering control block

The goal of the filtering control block is:


Fig2. Tables in Filtering control block

For Trellis, we need to configure an interface with VLAN for all edge ports, which will be one of:


Forwarding classifier table is a table to classify the packet by using combinations of match keys and use a metadata to store traffic class, list below includes classes supported by fabric.p4:


Forwarding control block:

Forwarding control block includes multiple tables for different forwarding types, the goal of this control block is:

Different match fields and actions for different table:


After setting up next id by tables, the packet will be processed by ACL table table to make final decision, ACL table may drop, punt to controller(set output port to CPU port) or do nothing to the packet.

Next control block:

Based on NextObjective, 3 tables included in the Next control block:


VLAN meta table:


Simple, Hashed, and Multicast table:

Each table matches a unique next id assigned by previous table and execute different kinds of action.

Actions in Next control block


Egress VLAN table:



Port Counter control block

Port counter control block includes a list of byte+packet counters, counts for different ingress and egress port