Charles Chan | fcfe890 | 2022-02-02 17:06:27 -0800 | [diff] [blame] | 1 | .. SPDX-FileCopyrightText: 2021 Open Networking Foundation <info@opennetworking.org> |
| 2 | .. SPDX-License-Identifier: Apache-2.0 |
| 3 | |
Carmelo Cascone | 7623e7c | 2021-10-13 17:45:27 -0700 | [diff] [blame] | 4 | .. _slicing_qos: |
| 5 | |
| 6 | Slicing and QoS |
Charles Chan | caebcf3 | 2021-09-20 22:17:52 -0700 | [diff] [blame] | 7 | =============== |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 8 | |
| 9 | .. _qos_configuration: |
| 10 | |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 11 | Overview |
| 12 | -------- |
| 13 | |
| 14 | Network slicing enables sharing the same physical infrastructure between |
| 15 | independent logical networks, each one targeting different use cases while |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 16 | providing isolation guarantees. Slicing permits the implementation of |
| 17 | tailor-made applications with Quality of Service (QoS) specific to the needs of |
| 18 | each slice, rather than a one-size-fits-all approach. |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 19 | |
| 20 | SD-Fabric supports slicing and QoS using dedicated hardware resources such as |
| 21 | scheduling queues and meters. Once a packet enters the fabric, it is associated |
| 22 | with a slice ID and traffic Class (TC). Slice ID is an arbitrary identifier, |
| 23 | while TC is used to determine the QoS parameters. The combination of slice ID |
| 24 | and TC is used by SD-Fabric to determine which switch hardware queue to use. |
| 25 | |
| 26 | We provide fabric-wide isolation and QoS guarantees. Packets are classified by |
| 27 | the first leaf switch in the path, we then use a custom DSCP-based marking |
| 28 | scheme to apply the same treatment on all switches. |
| 29 | |
| 30 | Classification can be achieved for both regular traffic via REST APIs, or for |
| 31 | GTP-U traffic terminated by P4-UPF using PFCP integration. |
| 32 | |
| 33 | Traffic Classes |
| 34 | ^^^^^^^^^^^^^^^ |
| 35 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 36 | We support the following traffic classes to cover the spectrum of potential |
| 37 | applications, from latency-sensitive to throughput-intensive. |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 38 | |
| 39 | Control |
| 40 | """"""" |
| 41 | For applications demanding ultra-low latency and jitter guarantees, with |
| 42 | non-bursty, low throughput requirements in the order of 100s of packets per |
| 43 | second. Examples of such applications are consensus protocols, industrial |
| 44 | automation, timing, etc. This class uses a queue shared by all slices, serviced |
| 45 | with the highest priority. To enforce isolation between slices, and to avoid |
| 46 | starvation of lower priority classes, each slice is processed through a |
| 47 | single-rate two-color meter. Slices sending at rates higher than the configured |
| 48 | meter rate might observe packet drops. |
| 49 | |
| 50 | Real-Time |
| 51 | """"""""" |
| 52 | For applications that require both low-latency and sustained throughput. |
| 53 | Examples of such applications are video and audio streaming. Each slice gets a |
| 54 | dedicated Real-Time queue serviced in a Round-Robin fashion to guarantee the |
| 55 | lowest latency at all times even with bursty senders. To avoid starvation of |
| 56 | lower priority classes, Real-Time queues are shaped at a maximum rate. Slices |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 57 | sending at rates higher than the configured maximum rate might observe higher |
| 58 | latency because of the queue shaping enforced by the scheduler. Real-Time queues |
| 59 | have priority lower than Control, but higher than Elastic. |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 60 | |
| 61 | Elastic |
| 62 | """"""" |
| 63 | For throughput-intensive applications with no latency requirements. This class |
| 64 | is best suited for large file transfers, Intranet/enterprise applications, |
| 65 | prioritized Internet access, etc. Each slice gets a dedicated Elastic queue |
| 66 | serviced in Weighted Round-Robin (WRR) fashion with configurable weights. During |
| 67 | congestion, Elastic queues are guaranteed to receive minimum bandwidth that can |
| 68 | grow up to the link capacity if other queues are empty. |
| 69 | |
| 70 | Best-Effort |
| 71 | """"""""""" |
| 72 | This is the default traffic class, used by packets not classified with any of |
| 73 | the above classes All slices share the same best-effort queue with lowest |
| 74 | priority. |
| 75 | |
| 76 | Classification |
| 77 | ^^^^^^^^^^^^^^^ |
| 78 | |
| 79 | Slice ID and TC classification can be performed in two ways. |
| 80 | |
| 81 | Regular traffic |
| 82 | """"""""""""""" |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 83 | We provide ACL-like APIs that support specifying wildcard match rules on the |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 84 | IPv4 5-tuple. |
| 85 | |
| 86 | P4-UPF traffic |
| 87 | """""""""""""" |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 88 | For GTP-U traffic terminated by the embedded P4-UPF function, selection of a |
| 89 | slice ID and TC is based on PFCP-Agent's configuration (upf.json or Helm |
| 90 | values). QoS classification uses the same table for GTP-U tunnel termination, |
| 91 | for this reason, to achieve fabric-wide QoS enforcement, we recommend enabling |
| 92 | the UPF function on each leaf switch using the distributed UPF mode, such that |
| 93 | packets are classified as soon as they enter the fabric. |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 94 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 95 | The slice ID is specified using the ``p4rtciface.slice_id`` property in |
| 96 | PFCP-Agent's ``upf.json``. All packets terminated by the P4-UPF function will be |
| 97 | associated with the given Slice ID. |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 98 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 99 | The TC value is instead derived from the 3GPP's QoS Flow Identifier (QFI) and |
| 100 | requires coordination with the mobile core control plane (e.g., SD-Core). When |
| 101 | deploying PFCP-Agent, you can configure a static many-to-one mapping between |
| 102 | 3GPP’s QFIs and SD-Fabric’s TCs using the ``p4rtciface.qfi_tc_mapping`` property |
| 103 | in ``upf.json``. That is, multiple QFIs can be mapped to the same TC. Then, it's |
| 104 | up to the mobile core control plane to insert PFCP rules classifying traffic |
| 105 | using the specific QFIs. |
Carmelo Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 106 | |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 107 | Configuration |
| 108 | ------------- |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 109 | .. 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 Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 112 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 113 | Stratum 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 Cascone | 450d903 | 2021-10-12 01:28:02 -0700 | [diff] [blame] | 117 | <https://github.com/stratum/stratum/blob/main/stratum/hal/bin/barefoot/README.run.md>`_ |
| 118 | in the Stratum repository. |
| 119 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 120 | The ONOS apps are responsible of inserting switch rules that map packets into |
| 121 | different queues. For this reason, apps needs to be aware of how queues are |
| 122 | mapped to the different slices and TCs. |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 123 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 124 | We provide a convenient `script |
| 125 | <https://github.com/stratum/fabric-tna/blob/main/util/gen-qos-config.py>`_ to |
| 126 | generate both the Stratum and ONOS configuration starting from a high-level |
| 127 | description provided via a YAML file. This file allows to define slices and |
| 128 | configure TC parameters. |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 129 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 130 | An example of such YAML file can be found here `here <https://github.com/stratum/fabric-tna/blob/main/util/sample-qos-config.yaml>`_. |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 131 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 132 | To generate the Stratum config: |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 133 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 134 | .. code-block:: console |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 135 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 136 | $ ./gen-qos-config.py -t stratum sample-qos-config.yaml |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 137 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 138 | The script will output a ``vendor_config`` section which is meant to be appended |
| 139 | to an existing Chassis Config file. |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 140 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 141 | To generate the ONOS config: |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 142 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 143 | .. code-block:: console |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 144 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 145 | $ ./gen-qos-config.py -t onos sample-qos-config.yaml |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 146 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 147 | The script will output a JSON snippet representing a complete ONOS netcfg file |
| 148 | with just the ``slicing`` portion of the ``fabric-tna`` app config. You will |
| 149 | have to manually integrate this into the existing ONOS netcfg used for |
| 150 | deployment. |
Wailok Shum | 08311e5 | 2021-09-30 23:22:12 +0800 | [diff] [blame] | 151 | |
| 152 | REST API |
| 153 | -------- |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 154 | Adding and removing slices in ONOS can be performed only via netcfg. We provide |
| 155 | REST APIs to: |
| 156 | - Get information on slices and TCs currently in the system |
| 157 | - Add/remove classifier rules |
Wailok Shum | 08311e5 | 2021-09-30 23:22:12 +0800 | [diff] [blame] | 158 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 159 | For the up-to-date documentation and example API calls, please refer to the |
| 160 | auto-generated documentation on a live ONOS instance at the URL |
| 161 | ``http://<ONOS-host>>:<ONOS-port>/onos/v1/docs``. |
Wailok Shum | 08311e5 | 2021-09-30 23:22:12 +0800 | [diff] [blame] | 162 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 163 | Make sure to select the Fabric-TNA RESt API view: |
Wailok Shum | 08311e5 | 2021-09-30 23:22:12 +0800 | [diff] [blame] | 164 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 165 | .. image:: ../images/fabric-tna-rest-api-select.png |
Wailok Shum | 08311e5 | 2021-09-30 23:22:12 +0800 | [diff] [blame] | 166 | :width: 700px |
| 167 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 168 | Classifier Flows |
| 169 | ^^^^^^^^^^^^^^^^ |
Wailok Shum | 08311e5 | 2021-09-30 23:22:12 +0800 | [diff] [blame] | 170 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 171 | We provide REST APIs to add/remove classifier flows. A classifier flow is used |
| 172 | to instruct switches on how to associate packets to slices and TCs. It is based |
| 173 | on abstraction similar to an ACL table, describing rules matching on the IPv4 |
| 174 | 5-tuple. |
Wailok Shum | 08311e5 | 2021-09-30 23:22:12 +0800 | [diff] [blame] | 175 | |
Carmelo Cascone | 46d6303 | 2022-03-07 00:22:30 -0800 | [diff] [blame] | 176 | Here's an example classifier flow in JSON format to be used in REST API calls. |
| 177 | For the actual API methods, please refer to the live ONOS documentation. |
Wailok Shum | 08311e5 | 2021-09-30 23:22:12 +0800 | [diff] [blame] | 178 | |
| 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 | } |