NrSdap

Package: simu5g.stack.sdap

simple module NrSdap

Implements the SDAP Protocol.

For PDUs received from the PDCP layer, extracts SDAP headers (if present), restores the associated QoS Flow based on QFI, and forwards the resulting SDUs to the upper layer (IP, Ethernet, or application for unstructured sessions).

For SDUs received from the upper layer, performs QFI-to-DRB mapping, encapsulates the data with SDAP headers if needed, and forwards the packets to the PDCP layer. On the gNB DL path, the QFI is always taken from the QfiReq tag (set by GtpUser). On the UE UL path two sources may answer: the classified QFI (the QfiReq tag, stamped by QosFlowClassifier’s rules or set by the application directly) and a reflective QoS match, the rule derived from observed downlink traffic. When both answer, reflectiveQosOverridesQfi says which wins; one alone is used as-is; a packet with neither joins the default QoS flow (QFI 0, the default DRB).

Whether a bearer’s packets carry an SDAP header is the control plane’s decision, delivered per bearer in the pushed configuration (computed by BearerConfigurator: a header is needed exactly when the QFI could not be recovered from the DRB alone on the RX side, unless the configuration suppresses it – see the suppressSdapHeader entry field there). On a headerless bearer both ends agree on the one QFI it carries – its sole mapped QFI, or QFI 0 when none is mapped: RX assigns that value to every packet, and TX verifies each packet against it, stopping with an error when another QoS flow shows up.

Flows of the D2D machinery are outside SDAP and pass through this module untouched in both directions: their bearers are peer-keyed, carry no QoS flows, and Ip2Nic assigns them (3GPP sidelink has its own SL-SDAP over PC5, which is not modeled). This holds in either mode – a D2D-capable pair’s flow keeps its ownership while in infrastructure mode, since the mode switch tears down and re-establishes within that machinery.

A received packet goes up as the protocol the type of the UE’s session implies (the sessionType parameter of LteUe), which every bearer’s configuration carries.

SDAP does not author its own configuration: the QFI-to-DRB mapping and the per-bearer SDAP settings are authored network-wide (see the staticDrbs parameter of BearerConfigurator), delivered to RRC, and pushed into this module from there at initialization.

Gates:

  • upperLayerIn/upperLayerOut: connects to the upper layer (Ip2Nic or app).

  • pdcpIn/pdcpOut: connects to the PDCP layer.

simu5g.stack.sdap.NrSdapNrSdapsimple

Usage diagram

Inheritance diagram

Used in compound modules

Name

Type

Description

NrNicEnb

compound module

The NrNicEnb module serves as a network interface that provides 5G connectivity within a gNodeB. It implements the data and signaling plane of the NR (New Radio) stack, which encompasses the PDCP, RLC, MAC, and PHY layers. The parameters and submodules facilitate the customization of the gNodeB’s behavior, including its support for CoMP (Coordinated MultiPoint) or dual connectivity. D2D support is added by the NrNicEnbD2D subtype.

NrNicUe

compound module

Defines a User Equipment (UE) network interface card that supports both LTE and NR (New Radio) technologies. It extends the LteNicUe module by adding additional submodules and parameters to support NR-specific functionalities. D2D support is added by the NrNicUeD2D subtype.

Parameters

Name

Type

Default value

Description

nodeRole

string

Node role: “UE” or “gNB” - determines reflective QoS behavior

connectionControlModule

string

“^.rrc.connectionControl”

The node’s control-plane entry point, the bearer-selection authority on a lookup miss

establishBearersOnDemand

bool

true

When false, a packet that finds no established bearer raises an error instead of establishing one (static bearers are established up front; see the staticDrbs parameter of BearerConfigurator)

reflectiveQosTableModule

string

“”

UE only: path to ReflectiveQosTable module (empty = disabled)

useReflectiveQos

bool

false

UE only

reflectiveQosOverridesQfi

bool

false

UE only: when a packet has both a classified QFI (QfiReq tag) and a reflective QoS match, true = the reflective QFI wins, false = the classified one; a packet with only one of the two always uses it

Properties

Name

Value

Description

display

i=block/layer

Gates

Name

Direction

Size

Description

upperLayerIn

input

From upper layer (Ip2Nic or app)

upperLayerOut

output

To upper layer (Ip2Nic or app)

pdcpIn

input

From PDCP layer

pdcpOut

output

To PDCP layer

Source code

//
// Implements the SDAP Protocol.
//
// For PDUs received from the PDCP layer, extracts SDAP headers (if present),
// restores the associated QoS Flow based on QFI, and forwards the resulting SDUs
// to the upper layer (IP, Ethernet, or application for unstructured sessions).
//
// For SDUs received from the upper layer, performs QFI-to-DRB mapping,
// encapsulates the data with SDAP headers if needed, and forwards the packets
// to the PDCP layer. On the gNB DL path, the QFI is always taken from the
// QfiReq tag (set by GtpUser). On the UE UL path two sources may answer: the
// classified QFI (the QfiReq tag, stamped by ~QosFlowClassifier's rules or set
// by the application directly) and a reflective QoS match, the rule derived
// from observed downlink traffic. When both answer, reflectiveQosOverridesQfi
// says which wins; one alone is used as-is; a packet with neither joins the
// default QoS flow (QFI 0, the default DRB).
//
// Whether a bearer's packets carry an SDAP header is the control plane's
// decision, delivered per bearer in the pushed configuration (computed by
// ~BearerConfigurator: a header is needed exactly when the QFI could not be
// recovered from the DRB alone on the RX side, unless the configuration
// suppresses it -- see the suppressSdapHeader entry field there). On a
// headerless bearer both ends agree on the one QFI it carries -- its sole
// mapped QFI, or QFI 0 when none is mapped: RX assigns that value to every
// packet, and TX verifies each packet against it, stopping with an error when
// another QoS flow shows up.
//
// Flows of the D2D machinery are outside SDAP and pass through this module
// untouched in both directions: their bearers are peer-keyed, carry no QoS
// flows, and ~Ip2Nic assigns them (3GPP sidelink has its own SL-SDAP over
// PC5, which is not modeled). This holds in either mode -- a D2D-capable
// pair's flow keeps its ownership while in infrastructure mode, since the
// mode switch tears down and re-establishes within that machinery.
//
// A received packet goes up as the protocol the type of the UE's session implies
// (the sessionType parameter of ~LteUe), which every bearer's configuration carries.
//
// SDAP does not author its own configuration: the QFI-to-DRB mapping and the
// per-bearer SDAP settings are authored network-wide (see the staticDrbs
// parameter of ~BearerConfigurator), delivered to RRC, and pushed into this module from
// there at initialization.
//
// Gates:
//  - upperLayerIn/upperLayerOut: connects to the upper layer (Ip2Nic or app).
//  - pdcpIn/pdcpOut: connects to the PDCP layer.
//
simple NrSdap like INrSdap
{
    parameters:
        string nodeRole @enum("UE", "gNB");  // Node role: "UE" or "gNB" - determines reflective QoS behavior
        string connectionControlModule = default("^.rrc.connectionControl");   // The node's control-plane entry point, the bearer-selection authority on a lookup miss
        bool establishBearersOnDemand = default(true);  // When false, a packet that finds no established bearer raises an error instead of establishing one (static bearers are established up front; see the staticDrbs parameter of ~BearerConfigurator)
        string reflectiveQosTableModule = default("");  // UE only: path to ReflectiveQosTable module (empty = disabled)
        bool useReflectiveQos = default(false); // UE only
        bool reflectiveQosOverridesQfi = default(false);  // UE only: when a packet has both a classified QFI (QfiReq tag) and a reflective QoS match, true = the reflective QFI wins, false = the classified one; a packet with only one of the two always uses it
        @display("i=block/layer");
    gates:
        input upperLayerIn;     // From upper layer (Ip2Nic or app)
        output upperLayerOut;   // To upper layer (Ip2Nic or app)
        input pdcpIn;           // From PDCP layer
        output pdcpOut;         // To PDCP layer
}

File: src/simu5g/stack/sdap/NrSdap.ned