# Effects of Transport Network Slicing on 5G Applications
## 5 The Network Slicing and Bandwidth Management  
To enforce 5G network slicing on the transport network, we implemented a bandwidth management mechanism [12] to regulate link usages. Figure 6 depicts its architecture, composed of a control plane running on the SDN controller and a data plane exercised in P4 switches.  
Slice Manager (Figure 6 (1)), an ONOS [22] application, works as the control plane and exposes a Slice REST API (Figure 6 (2)) for slice configuration and bandwidth management. Slice Manager follows specifications given by the NFVO through the Slice REST API, turns the slice specifications into flow rules, and feeds the flow rules to the data plane. A slice could be a single flow identified by the five-tuple or a set of flows with the same IP destination or other granularities.  
The data plane leverages the Two Rate Three Color Marker (trTCM) [23] of the P4 Meter for packet classification. The trTCM meters a data flow stream and marks packets of the flow according to four user-configurable parameters--the Peak Information Rate (PIR), the CIR, and their respective burst sizes. The PIR is the highest data rate allowed for the flow, while the CIR is the lowest flow rate guaranteed by the network. Specifically, trTCM marks an incoming flow packet as green, yellow, or red by comparing the metered flow rate with the PIR and CIR settings. The packet is marked red if the rate exceeds the PIR, green if the rate is lower than the CIR, and yellow if the measured rate is lower than the PIR but higher than the CIR. The bandwidth management mechanism guarantees delivery for green packets, delivers yellow packets with best-effort, and discards all red packets.  
A P4 program called Meter.p4 (Figure 6 (3)) implements the above mechanism, performing packet classification, traffic policing, and traffic shaping. Meter.p4 defines a data plane pipeline of three stages--the Classifier/Slicer, the Marker, and the Policer, while Slice Manager is responsible for populating the flow rules on the P4 pipeline. The Classifier/Slicer stage identifies the slice of an incoming packet via the populated flow rules. It keeps the corresponding slice ID in a metadata field associated with the packet. The Marker stage uses the slice ID to select the corresponding meter from an array of trTCM meters. The meter then classifies packets into green, yellow, or red, based on the metered flow rate  
Figure 6: P4-enabled slice and bandwidth management mechanism. The Meter.p4 (**3**) is a customized data plane for strict bandwidth guarantee and rate-limiting. The Slice Manager (**1**) exposes a Slice REST API (**2**) for the Network Function Virtualization Orchestrator (NFVO) and manipulates flow rules in the data plane through the P4 Runtime APIs.  
and the PIR and CIR settings. The Policer stage dispatches green and yellow packets to high-priority and low-priority queues, respectively, and discards all red packets. This stage also dispatches packets of non-slicing flows to the low-priority queue. All packets in the high-priority queue are guaranteed with delivery, provided that the total bandwidth of all slicing flows does not exceed the link capacity. In contrast, the low-priority queue can only utilize the forwarding link to deliver yellow packets with best-effort when the high-priority queue is empty.  
To investigate network slicing effects on IoT applications, we fed real traffic from many applications described in Section 3 into the NCTU testbed. Therefore, we have measured and obtained the traffic characteristics of these applications, and then emulated these applications accordingly through SimTalk. In the emulation mode of SimTalk, real applications and their emulated counterparts can coexist in the experiments, making it much more realistic than the simulation approach.