blob: fcbb514be8b8460fa73bc98544c92aabd5148e6a [file] [log] [blame]
Charles Chanfcfe8902022-02-02 17:06:27 -08001.. SPDX-FileCopyrightText: 2021 Open Networking Foundation <info@opennetworking.org>
2.. SPDX-License-Identifier: Apache-2.0
3
Carmelo Cascone7623e7c2021-10-13 17:45:27 -07004.. _slicing_qos:
5
6Slicing and QoS
Charles Chancaebcf32021-09-20 22:17:52 -07007===============
Daniele Moroed033562021-10-04 16:12:31 +02008
9.. _qos_configuration:
10
Carmelo Cascone450d9032021-10-12 01:28:02 -070011Overview
12--------
13
14Network slicing enables sharing the same physical infrastructure between
15independent logical networks, each one targeting different use cases while
Carmelo Cascone46d63032022-03-07 00:22:30 -080016providing isolation guarantees. Slicing permits the implementation of
17tailor-made applications with Quality of Service (QoS) specific to the needs of
18each slice, rather than a one-size-fits-all approach.
Carmelo Cascone450d9032021-10-12 01:28:02 -070019
20SD-Fabric supports slicing and QoS using dedicated hardware resources such as
21scheduling queues and meters. Once a packet enters the fabric, it is associated
22with a slice ID and traffic Class (TC). Slice ID is an arbitrary identifier,
23while TC is used to determine the QoS parameters. The combination of slice ID
24and TC is used by SD-Fabric to determine which switch hardware queue to use.
25
26We provide fabric-wide isolation and QoS guarantees. Packets are classified by
27the first leaf switch in the path, we then use a custom DSCP-based marking
28scheme to apply the same treatment on all switches.
29
30Classification can be achieved for both regular traffic via REST APIs, or for
31GTP-U traffic terminated by P4-UPF using PFCP integration.
32
33Traffic Classes
34^^^^^^^^^^^^^^^
35
Carmelo Cascone46d63032022-03-07 00:22:30 -080036We support the following traffic classes to cover the spectrum of potential
37applications, from latency-sensitive to throughput-intensive.
Carmelo Cascone450d9032021-10-12 01:28:02 -070038
39Control
40"""""""
41For applications demanding ultra-low latency and jitter guarantees, with
42non-bursty, low throughput requirements in the order of 100s of packets per
43second. Examples of such applications are consensus protocols, industrial
44automation, timing, etc. This class uses a queue shared by all slices, serviced
45with the highest priority. To enforce isolation between slices, and to avoid
46starvation of lower priority classes, each slice is processed through a
47single-rate two-color meter. Slices sending at rates higher than the configured
48meter rate might observe packet drops.
49
50Real-Time
51"""""""""
52For applications that require both low-latency and sustained throughput.
53Examples of such applications are video and audio streaming. Each slice gets a
54dedicated Real-Time queue serviced in a Round-Robin fashion to guarantee the
55lowest latency at all times even with bursty senders. To avoid starvation of
56lower priority classes, Real-Time queues are shaped at a maximum rate. Slices
Carmelo Cascone46d63032022-03-07 00:22:30 -080057sending at rates higher than the configured maximum rate might observe higher
58latency because of the queue shaping enforced by the scheduler. Real-Time queues
59have priority lower than Control, but higher than Elastic.
Carmelo Cascone450d9032021-10-12 01:28:02 -070060
61Elastic
62"""""""
63For throughput-intensive applications with no latency requirements. This class
64is best suited for large file transfers, Intranet/enterprise applications,
65prioritized Internet access, etc. Each slice gets a dedicated Elastic queue
66serviced in Weighted Round-Robin (WRR) fashion with configurable weights. During
67congestion, Elastic queues are guaranteed to receive minimum bandwidth that can
68grow up to the link capacity if other queues are empty.
69
70Best-Effort
71"""""""""""
72This is the default traffic class, used by packets not classified with any of
73the above classes All slices share the same best-effort queue with lowest
74priority.
75
76Classification
77^^^^^^^^^^^^^^^
78
79Slice ID and TC classification can be performed in two ways.
80
81Regular traffic
82"""""""""""""""
Carmelo Cascone46d63032022-03-07 00:22:30 -080083We provide ACL-like APIs that support specifying wildcard match rules on the
Carmelo Cascone450d9032021-10-12 01:28:02 -070084IPv4 5-tuple.
85
86P4-UPF traffic
87""""""""""""""
Carmelo Cascone46d63032022-03-07 00:22:30 -080088For GTP-U traffic terminated by the embedded P4-UPF function, selection of a
89slice ID and TC is based on PFCP-Agent's configuration (upf.json or Helm
90values). QoS classification uses the same table for GTP-U tunnel termination,
91for this reason, to achieve fabric-wide QoS enforcement, we recommend enabling
92the UPF function on each leaf switch using the distributed UPF mode, such that
93packets are classified as soon as they enter the fabric.
Carmelo Cascone450d9032021-10-12 01:28:02 -070094
Carmelo Cascone46d63032022-03-07 00:22:30 -080095The slice ID is specified using the ``p4rtciface.slice_id`` property in
96PFCP-Agent's ``upf.json``. All packets terminated by the P4-UPF function will be
97associated with the given Slice ID.
Carmelo Cascone450d9032021-10-12 01:28:02 -070098
Carmelo Cascone46d63032022-03-07 00:22:30 -080099The TC value is instead derived from the 3GPP's QoS Flow Identifier (QFI) and
100requires coordination with the mobile core control plane (e.g., SD-Core). When
101deploying PFCP-Agent, you can configure a static many-to-one mapping between
1023GPP’s QFIs and SD-Fabric’s TCs using the ``p4rtciface.qfi_tc_mapping`` property
103in ``upf.json``. That is, multiple QFIs can be mapped to the same TC. Then, it's
104up to the mobile core control plane to insert PFCP rules classifying traffic
105using the specific QFIs.
Carmelo Cascone450d9032021-10-12 01:28:02 -0700106
Daniele Moroed033562021-10-04 16:12:31 +0200107Configuration
108-------------
Carmelo Cascone46d63032022-03-07 00:22:30 -0800109.. note:: Currently we only support static configuration at switch startup. To
110 add new slices or modify TC parameters, you will need to reboot the switch.
111 Dynamic configuration will be supported in future SD-Fabric releases.
Daniele Moroed033562021-10-04 16:12:31 +0200112
Carmelo Cascone46d63032022-03-07 00:22:30 -0800113Stratum allows configuring switch queues and schedulers using the
114``vendor_config`` portion of the Chassis Config file (see
115:ref:`stratum_chassis_config`). For more information on the format of
116``vendor_config``, see the `guide for running Stratum on Tofino-based switches
Carmelo Cascone450d9032021-10-12 01:28:02 -0700117<https://github.com/stratum/stratum/blob/main/stratum/hal/bin/barefoot/README.run.md>`_
118in the Stratum repository.
119
Carmelo Cascone46d63032022-03-07 00:22:30 -0800120The ONOS apps are responsible of inserting switch rules that map packets into
121different queues. For this reason, apps needs to be aware of how queues are
122mapped to the different slices and TCs.
Daniele Moroed033562021-10-04 16:12:31 +0200123
Carmelo Cascone46d63032022-03-07 00:22:30 -0800124We provide a convenient `script
125<https://github.com/stratum/fabric-tna/blob/main/util/gen-qos-config.py>`_ to
126generate both the Stratum and ONOS configuration starting from a high-level
127description provided via a YAML file. This file allows to define slices and
128configure TC parameters.
Daniele Moroed033562021-10-04 16:12:31 +0200129
Carmelo Cascone46d63032022-03-07 00:22:30 -0800130An example of such YAML file can be found here `here <https://github.com/stratum/fabric-tna/blob/main/util/sample-qos-config.yaml>`_.
Daniele Moroed033562021-10-04 16:12:31 +0200131
Carmelo Cascone46d63032022-03-07 00:22:30 -0800132To generate the Stratum config:
Daniele Moroed033562021-10-04 16:12:31 +0200133
Carmelo Cascone46d63032022-03-07 00:22:30 -0800134.. code-block:: console
Daniele Moroed033562021-10-04 16:12:31 +0200135
Carmelo Cascone46d63032022-03-07 00:22:30 -0800136 $ ./gen-qos-config.py -t stratum sample-qos-config.yaml
Daniele Moroed033562021-10-04 16:12:31 +0200137
Carmelo Cascone46d63032022-03-07 00:22:30 -0800138The script will output a ``vendor_config`` section which is meant to be appended
139to an existing Chassis Config file.
Daniele Moroed033562021-10-04 16:12:31 +0200140
Carmelo Cascone46d63032022-03-07 00:22:30 -0800141To generate the ONOS config:
Daniele Moroed033562021-10-04 16:12:31 +0200142
Carmelo Cascone46d63032022-03-07 00:22:30 -0800143.. code-block:: console
Daniele Moroed033562021-10-04 16:12:31 +0200144
Carmelo Cascone46d63032022-03-07 00:22:30 -0800145 $ ./gen-qos-config.py -t onos sample-qos-config.yaml
Daniele Moroed033562021-10-04 16:12:31 +0200146
Carmelo Cascone46d63032022-03-07 00:22:30 -0800147The script will output a JSON snippet representing a complete ONOS netcfg file
148with just the ``slicing`` portion of the ``fabric-tna`` app config. You will
149have to manually integrate this into the existing ONOS netcfg used for
150deployment.
Wailok Shum08311e52021-09-30 23:22:12 +0800151
152REST API
153--------
Carmelo Cascone46d63032022-03-07 00:22:30 -0800154Adding and removing slices in ONOS can be performed only via netcfg. We provide
155REST APIs to:
156- Get information on slices and TCs currently in the system
157- Add/remove classifier rules
Wailok Shum08311e52021-09-30 23:22:12 +0800158
Carmelo Cascone46d63032022-03-07 00:22:30 -0800159For the up-to-date documentation and example API calls, please refer to the
160auto-generated documentation on a live ONOS instance at the URL
161``http://<ONOS-host>>:<ONOS-port>/onos/v1/docs``.
Wailok Shum08311e52021-09-30 23:22:12 +0800162
Carmelo Cascone46d63032022-03-07 00:22:30 -0800163Make sure to select the Fabric-TNA RESt API view:
Wailok Shum08311e52021-09-30 23:22:12 +0800164
Carmelo Cascone46d63032022-03-07 00:22:30 -0800165.. image:: ../images/fabric-tna-rest-api-select.png
Wailok Shum08311e52021-09-30 23:22:12 +0800166 :width: 700px
167
Carmelo Cascone46d63032022-03-07 00:22:30 -0800168Classifier Flows
169^^^^^^^^^^^^^^^^
Wailok Shum08311e52021-09-30 23:22:12 +0800170
Carmelo Cascone46d63032022-03-07 00:22:30 -0800171We provide REST APIs to add/remove classifier flows. A classifier flow is used
172to instruct switches on how to associate packets to slices and TCs. It is based
173on abstraction similar to an ACL table, describing rules matching on the IPv4
1745-tuple.
Wailok Shum08311e52021-09-30 23:22:12 +0800175
Carmelo Cascone46d63032022-03-07 00:22:30 -0800176Here's an example classifier flow in JSON format to be used in REST API calls.
177For the actual API methods, please refer to the live ONOS documentation.
Wailok Shum08311e52021-09-30 23:22:12 +0800178
179.. code-block:: json
180
181 {
182 "criteria": [
183 {
184 "type": "IPV4_SRC",
185 "ip": "10.0.0.1/32"
186 },
187 {
188 "type": "IPV4_DST",
189 "ip": "10.0.0.2/32"
190 },
191 {
192 "type": "IP_PROTO",
193 "protocol": 6
194 },
195 {
196 "type": "TCP_SRC",
197 "tcpPort": 1000
198 },
199 {
200 "type": "TCP_DST",
201 "tcpPort": 80
202 },
203 {
204 "type": "UDP_SRC",
205 "udpPort": 1000
206 },
207 {
208 "type": "UDP_DST",
209 "udpPort": 1812
210 }
211 ]
212 }