# Dynamic QoS Management for a Flexible 5G/6G Network Core: A Step toward a Higher Programability
## 5 Testbed Design
### Methodology Implementation  
The implementation of the proposed methodology has started by analyzing QoS policies in an SQL database, which we use as a source of information required for dynamically configuring the QoS. Each entry in the database represents a group of services provided by a single slice and contains the following attributes (Figure 5):  
* Unique user identification (e.g., IMSI and IMEI);
* The unique slice identifier;
* The IP address of the service group provider;
* Download link capacity portion (percentage) requirement at the slice level;
* Upload link capacity portion (percentage) requirement at the slice level;
* Minimum download bandwidth requirement at the slice level;
* Minimum upload bandwidth requirement at the slice level;
* Priority index to set bandwidth allocation order. \begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Slice Name**} & \multirow{2}{*}{**Service Group**} & **Download** & \multirow{2}{*}{**Upload Throughput**} \\  & & **Throughput** & \\ \hline Internet & Web surfing & 0.5–40 Mbps, & 0–0.4 Mbps, \\  & & 150–1500 pps & 50–300 pps \\ \hline Multimedia & Video streaming & 5.5–6.2 Mbps, & 0–0.2 Mbps, \\  & & 1800–2200 pps & 0–20 pps \\ \hline Security & Sensors and surveillance stream & 0–0.2 Mbps, & 2.8–3.2 Mbps, \\  & & 0–20 pps & 820–940 pps \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Slice arrangement in testbed. Additionally, our solution includes a logically separated SQL database table that stores the predicted total download and upload link capacity for each user. These stored values are used in the intelligent calculation of max bandwidth for every slice. We use these attributes to manage queues on the BasestationSDN and CarSDN switches. The slice ID is simply used to look up the other attributes from the SQL database. These slice policy attributes are then used to calculate download rate (maximum allowed download throughput of the queue) and set on BasestationSDN, while upload rate (maximum allowed upload throughput of the queue) is set on the CarSDN switch. The IP address of the service group's server is used to define the proactive flows to which the corresponding queues will be applied. The software solution for dynamic QoS is written in Python and provided as an open-source project [53]. The responsibility of this software is to configure queue and flow tables on SDN switches according to database entries. Synchronization between the desired state (defined in SQL database) and an actual state on switches (queue and flow tables) is achieved periodically executing Python script. We initiate a single instance of the Python script at each SDN controller. Each SDN controller is responsible for its slice, and it is also responsible for both SDN switches when it comes to their services. Therefore, the purpose of the Python script is to handle the dynamic part of the QoS configuration on SDN switches. The Python script accepts two input parameters:  
* SliceID;
* A period after which the script program repeats (in seconds)--this represents a database polling interval. Queues and proactive flows are configured using the ovs-vsctl command line (part of the Open vSwitch tools). The implementation of the proposed methodology is described in Algorithm 1 and the process diagram is depicted in Figure 6.  
``` Input: current queue query in SQL table
1:if queue entry does not exist in SQL table then
2:if queue entry does not exist on switches then
3:do nothing
4:else
5: delete proactive flows on switches
6: delete queues on switches
7:endif
8:else
9:if queue entry does not exist on switches then
10: add queues on switches
11: add proactive flows on switches
12:else
13:if current query result \(\
eq\) previous query result then
14: modify queues on switches
15:endif
16:endif
17:endif

Figure 5: SQL database sample. The first step is to fetch the content of the SQL database. Any change of download or upload parameters will result in the configuration of these queues that we apply on both switches.