QoD sessions
Quality on Demand (QoD) profiles
Oftentimes, it is necessary to manage or prioritize certain connectivity characteristics over a wide area network (WAN). Network as Code Quality on Demand profiles allow establishing these prioritized connections between devices or services and request on-demand capabilities from the network. Read more about it on the "What is quality of service?" section.
Network as Code QoD profiles
You can choose the amount of bandwidth with an up/downlink profile label, according to your current demand. These are the specific Network as Code QoD profiles labels and their brief description:
| QoD profile labels | Network Service Description |
|---|---|
| DOWNLINK_S_UPLINK_S | small downlink and uplink bandwidth |
| DOWNLINK_S_UPLINK_M | small downlink and medium uplink bandwidth |
| DOWNLINK_S_UPLINK_L | small downlink and large uplink bandwidth |
| DOWNLINK_M_UPLINK_S | medium downlink and small uplink bandwidth |
| DOWNLINK_M_UPLINK_M | medium downlink and medium uplink bandwidth |
| DOWNLINK_M_UPLINK_L | medium downlink and large uplink bandwidth |
| DOWNLINK_L_UPLINK_S | large downlink and small uplink bandwidth |
| DOWNLINK_L_UPLINK_M | large downlink and medium uplink bandwidth |
| DOWNLINK_L_UPLINK_L | large downlink and large uplink bandwidth |
NOTE: In each case, the network connection is given priority, which means that the network will aim at maintaining a stable connection at the desired level.
CAMARA QoS profiles
QoD Sessions also support the CAMARA QoS profile labels.
NOTE: You can learn more specifically about each label or its possible constraints here.
These are the currently available ones:
| QOS Profile labels | Network Service Description |
|---|---|
| QOS_E | Maintains stable latency under congestion with limited bandwidth. |
| QOS_L | Prioritizes the throughput up to a certain higher limit or no explicit limit. |
| QOS_M | Prioritizes the throughput up to a certain medium limit. |
| QOS_S | Prioritizes the throughput up to a certain lower limit. |
Good to know: The 5G System throughput refers to the ratio of data that can be transmitted in units of time, for example, bits per second(bps). In this case, a maximum throughput refers to a maximum rate at which data will be transmitted.
Creating a QoD session
Applications can create a QoD session
with a required Quality on Demand profile.
A QoD session has a life cycle
so you can keep track of different QoD statuses.
You must specify a duration, which
can be up to 24 hours. You can also terminate a QoD session
whenever needed to avoid unexpected costs over time.
Creating your first session
If you already got setup with Network as Code Getting Started steps, follow this tutorial to create your first QoD session. Also notice that in this section, we will explain all the QoD capabilities in detail.
A QoD session is created with an SDK, which will instruct how the network should behave for a particular device connected to it. This way, developers like you can decide which device or network service gets prioritized or not to ensure higher-quality and stable bandwidth use.
The programming of the mobile network happens when we call the method to create a QoD
session. We instruct Network as Code to set up a QoD Session between the device and
the service identified by the IP address 233.252.0.2. In the call parameters, we also
specify a session Quality on Demand profile (in this case a QOS_L) which will ensure
maximum bandwidth between these two endpoints.
from network_as_code import NetworkAsCodeApi
client = NetworkAsCodeApi(
rapidapi_host="network-as-code.nokia.rapidapi.com",
api_key="YOUR_API_KEY",
)
response = client.qod.create_session_v1(
application_server={
"ipv_4_address": "233.252.0.2"
},
qos_profile="QOS_L",
device={
"phone_number": "+99999991001",
"ipv_4_address": {
"publicAddress": "233.252.0.2",
"privateAddress": "192.0.2.25",
"publicPort": 80,
},
},
duration=3600,
)
print(response)Session duration
You need to create a QoD session with a duration to instruct how the network should behave during a specified amount of time.
The duration is given in seconds with a default value and upper limit at 24 hours.
For example, if the duration desired is for one hour, then the value in seconds should be 3600.
Extending QoD sessions
It is possible to extend the length of a QoD session after the session was created. This might be handy in case an action takes longer than expected and more time needs to be assigned to the session without creating an interruption. Similar to setting an initial duration, the session duration is extended by specifying the number of seconds the session should be extended by.
Session can be extended by 300 seconds like so:
from network_as_code import NetworkAsCodeApi
client = NetworkAsCodeApi(
rapidapi_host="network-as-code.nokia.rapidapi.com",
api_key="YOUR_API_KEY",
)
response = client.qod.extend_session_v1(
session_id="sessionId",
requested_additional_duration=300,
)
print(response)Ports
For better control and optimized bandwidth or latency, you can also choose whether to use ports. This may be useful in cases where you want to set up session between specific applications. However, the QoD capability will work even without providing them.
You can use a range of ports:
from network_as_code import NetworkAsCodeApi
client = NetworkAsCodeApi(
rapidapi_host="network-as-code.nokia.rapidapi.com",
api_key="YOUR_API_KEY",
)
my_session = client.qod.create_session_v1(
device={"phone_number": "+999991234567"},
application_server={"ipv_4_address": "233.252.0.2"},
qos_profile="QOS_L",
device_ports={"ranges": [{"from": 80, "to": 443}]},
application_server_ports={"ranges": [{"from": 80, "to": 443}]},
duration=3600,
)Or you can also specify a list of ports:
from network_as_code import NetworkAsCodeApi
client = NetworkAsCodeApi(
rapidapi_host="network-as-code.nokia.rapidapi.com",
api_key="YOUR_API_KEY",
)
my_session = client.qod.create_session_v1(
device={"phone_number": "+999991234567"},
application_server={"ipv_4_address": "233.252.0.2"},
qos_profile="QOS_L",
device_ports={"ports": [1600, 2000]},
application_server_ports={"ports": [80, 443]},
duration=3600,
)Session parameters
| Parameters | Type | Description | Mandatory or Optional |
|---|---|---|---|
qos_profile | string | The QoD profile that indicates the connection type to be prioritized between two points. | Mandatory |
application_server | object | The application server object containing the service IP address(es). | Mandatory |
application_server.ipv_4_address | string | The service identified by the application IPv4 address. | Mandatory (if no IPv6) |
application_server.ipv_6_address | string | The service identified by the application IPv6 address. | Mandatory (if no IPv4) |
application_server_ports | object | To specify a list of ports or a range of ports for the application server. | Optional |
device_ports | object | To specify a list of ports or a range of ports for a device. | Optional |
duration | integer | The length of the QoD session in seconds. If not set, defaults to the maximum of 86400 seconds (24 hours). | Optional |
Managing QoD sessions
Here, we will show how to get a QoD session using multiple methods. If you previously created a session and you need to modify or delete it, you can easily retrieve it by its ID or index. You can do so by using the following examples:
Get all QoD sessions
from network_as_code import NetworkAsCodeApi
client = NetworkAsCodeApi(
rapidapi_host="network-as-code.nokia.rapidapi.com",
api_key="YOUR_API_KEY",
)
response = client.qod.retrieve_sessions_v1(
device={
"phone_number": "+99999991001"
}
)
print(response)Get session by ID
from network_as_code import NetworkAsCodeApi
client = NetworkAsCodeApi(
rapidapi_host="network-as-code.nokia.rapidapi.com",
api_key="YOUR_API_KEY",
)
response = client.qod.get_session_v1(
session_id="sessionId",
)
print(response)Response parameters
| Parameters | Type | Description |
|---|---|---|
session_id | string | Session resource identifier. |
qos_profile | string | The QoD profile that indicates the connection type to be prioritized between two points. |
status | string | QoD session status, whether it is REQUESTED, AVAILABLE, UNAVAILABLE. |
started_at | datetime | Timezone-aware timestamp when the session started. |
expires_at | datetime | Timezone-aware timestamp when the session expires. |
ipv4_address | string | The service identified by the application IPv4 address. |
ipv6_address | string | The service identified by the application IPv6 address. |
application_server_ports | integer | A list of ports or a range of ports for a service if defined. |
device_ports | integer | A list of ports or a range of ports for a device if defined. |
duration | integer | The length of the QoD session in seconds (maximum: 86400 seconds = 24 hours). |
Deleting a session
In the example below, we delete specific sessions by their index or ID.
from network_as_code import NetworkAsCodeApi
client = NetworkAsCodeApi(
rapidapi_host="network-as-code.nokia.rapidapi.com",
api_key="YOUR_API_KEY",
)
response = client.qod.delete_session_v1(
session_id="sessionId"
)
print(response)Last updated September 18, 2026