QoD sessions

Quality on Demand (QoD) profilesheader link

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 profilesheader link

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 labelsNetwork Service Description
DOWNLINK_S_UPLINK_Ssmall downlink and uplink bandwidth
DOWNLINK_S_UPLINK_Msmall downlink and medium uplink bandwidth
DOWNLINK_S_UPLINK_Lsmall downlink and large uplink bandwidth
DOWNLINK_M_UPLINK_Smedium downlink and small uplink bandwidth
DOWNLINK_M_UPLINK_Mmedium downlink and medium uplink bandwidth
DOWNLINK_M_UPLINK_Lmedium downlink and large uplink bandwidth
DOWNLINK_L_UPLINK_Slarge downlink and small uplink bandwidth
DOWNLINK_L_UPLINK_Mlarge downlink and medium uplink bandwidth
DOWNLINK_L_UPLINK_Llarge 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 profilesheader link

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 labelsNetwork Service Description
QOS_EMaintains stable latency under congestion with limited bandwidth.
QOS_LPrioritizes the throughput up to a certain higher limit or no explicit limit.
QOS_MPrioritizes the throughput up to a certain medium limit.
QOS_SPrioritizes 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 sessionheader link

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 sessionheader link

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 durationheader link

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 sessionsheader link

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)

Portsheader link

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 parametersheader link

ParametersTypeDescriptionMandatory or Optional
qos_profilestringThe QoD profile that indicates the connection type to be prioritized between two points.Mandatory
application_serverobjectThe application server object containing the service IP address(es).Mandatory
application_server.ipv_4_addressstringThe service identified by the application IPv4 address.Mandatory (if no IPv6)
application_server.ipv_6_addressstringThe service identified by the application IPv6 address.Mandatory (if no IPv4)
application_server_portsobjectTo specify a list of ports or a range of ports for the application server.Optional
device_portsobjectTo specify a list of ports or a range of ports for a device.Optional
durationintegerThe length of the QoD session in seconds. If not set, defaults to the maximum of 86400 seconds (24 hours).Optional

Managing QoD sessionsheader link

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 sessionsheader link

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 IDheader link

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 parametersheader link

ParametersTypeDescription
session_idstringSession resource identifier.
qos_profilestringThe QoD profile that indicates the connection type to be prioritized between two points.
statusstringQoD session status, whether it is REQUESTED, AVAILABLE, UNAVAILABLE.
started_atdatetimeTimezone-aware timestamp when the session started.
expires_atdatetimeTimezone-aware timestamp when the session expires.
ipv4_addressstringThe service identified by the application IPv4 address.
ipv6_addressstringThe service identified by the application IPv6 address.
application_server_portsintegerA list of ports or a range of ports for a service if defined.
device_portsintegerA list of ports or a range of ports for a device if defined.
durationintegerThe length of the QoD session in seconds (maximum: 86400 seconds = 24 hours).

Deleting a sessionheader link

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