Skip to main content
Version: v5.0.1 [Emerald]

Lab 7 Traffic Steering rApp

In this lab, you will deploy a 5G Standalone (SA) network using OAI CU/DU with USRPs, OAI CN, FlexRIC as the Near-RT RIC, and a Quectel module as a COTS UE. This experiment requires at least two USRPs and one Quectel module.

In the second phase of the experiment, you will use the BubbleRAN rApp SDK to develop and deploy a Traffic Steering (TS) rApp that sends traffic steering policies to the Non-RT RIC via the R1 interface. These policies are then forwarded to the Near-RT RIC over the A1 interface, where a corresponding xApp monitors UE and cell conditions and enforces the policies at the gNB via the E2 interface by triggering handovers between cells. As a result, UEs will be dynamically steered from one cell to another according to the defined policies, demonstrating policy-driven control of UE mobility in the RAN.

ho-net.yaml
apiVersion: athena.trirematics.io/v1
kind: Network
metadata:
name: handover
namespace: trirematics
spec:
slices:
- plmn: "00101"
dnn: "internet"
network-mode: "IPv4"
service-type: 1
differentiator: 0x000000
ipv4-range: "12.1.1.0/24"
ipv6-range: "2001:db8:1::/64"
access:
- name: oai-gnb-cu-du
stack: 5g-sa
model: oai-ran/cu-du
radio:
device: uhd-b200
identity:
an-id: 50
cells:
- band: n78
arfcn: 630048
bandwidth: 40MHz
subcarrier-spacing: 30kHz
tdd-config:
period: 5000
dl-slots: 7
dl-symbols: 6
ul-slots: 2
ul-symbols: 4
groups:
- kind: hog
name: handover-group
controller: flexric.handover
core-networks:
- minimal.handover
- name: oai-gnb-du
stack: 5g-sa
model: oai-ran/du
radio:
device: uhd-b200
identity:
an-id: 20
annotations:
extras.t9s.io/cu-name: "oai-gnb-cu-du"
cells:
- band: n78
arfcn: 643296
bandwidth: 40MHz
subcarrier-spacing: 30kHz
tdd-config:
period: 5000
dl-slots: 7
dl-symbols: 6
ul-slots: 2
ul-symbols: 4
groups:
- kind: hog
name: handover-group
controller: flexric.handover
core-networks:
- minimal.handover
core:
- name: minimal
stack: 5g-sa
model: oai-cn/minimal
identity:
region: 0
cn-group: 4
cn-id: 5
edge:
- name: flexric
stack: 5g-sa
model: mosaic5g/flexric
dns:
ipv4:
default: 8.8.8.8
secondary: 8.8.4.4
---
apiVersion: athena.trirematics.io/v1
kind: Terminal
metadata:
name: ue1
namespace: trirematics
spec:
vendor: oai
stack: 5g-sa
model: terminal/quectel
target-cores:
- minimal.handover
identity:
imsi: "001010000000011"
pin: "1234"
opc: "0xC42449363BBAD02B66D16BC975D77CC1"
key: "0xfec86ba6eb707ed08905757b1bb44b8f"
sqn: "0xff9bb4000001"
slice:
dnn: internet
network-mode: IPv4
service-type: 1
differentiator: 0x000000
radio:
bands:
- n78
- n77
readiness-check:
method: ping
target: google-ip

Network Deployment

Deploy the file using the command brc install network ho-net.yaml.

tip

The initial ho-net.yaml file does not include the xApp. The xApp for performing handovers will be deployed automatically by the SMO at a later stage in the experiment.

Check for the status of the deployment using the command brc observe and make sure all the Elements are in the 1/1 Y state.

Before starting the traffic steering rApp, test UE connectivity:

brc test rtt ue1 gateway -- -c 3

Traffic control Enforcement via rApp

ts-rapp.py
from br_rapp_sdk import A1Services
from br_rapp_sdk.a1_services.a1_policy_types import *


if __name__ == "__main__":

# Initialize the A1Services client
a1_services = A1Services()

# Build PolicyObjectInformation
policyinfo = PolicyObjectInformation(
near_rt_ric_id=NearRtRicId("flexric.handover"),
policy_type_id=PolicyTypeId("bubbleran/ts"),
policy_object=PolicyObject(
# ScopeIdentifier indicates which UE or scope this policy affects
scope_identifier=ScopeIdentifier(
ue_id="0000000000000000" # Example UE ID. "0000000000000000" means apply to ALL UEs; replace with a specific RAN UE ID to target a single UE
),
# PolicyStatements contains the actual resources or rules to be enforced
policy_statements=PolicyStatements(
policy_resources=PolicyResources(
tsp_resources=TspResources(
tsp_resources=[
TspResource(
preference=PreferenceType.SHALL,
cell_id_list=[
CellId(c_id=CId(nc_i=50))
]
)
]
)
)
)
)
)

# Print the policy object in YAML format for inspection before applying
print("Policy Object Information: \n", policyinfo.yaml())

# Apply the policy
policy_name = "handover1"
result = a1_services.apply_policy(policy_name=policy_name, policy_object=policyinfo)

# Check the result of the operation
if result.status == 'success':
policy_id = result.data.get('policy_id')
print(f"Policy applied successfully: {policy_id}")
else:
print(f"Error applying policy: {result.error}")

Use the following command to run the rApp within the cluster:

python3 ./ts-rapp.py
danger

Make sure the BubbleRAN rApp SDK is installed in your environment. You can install it using the command pip3 install br-rapp-sdk.

danger

Run the rApp inside the cluster, and make sure your kubeconfig file is located at ~/.kube/config.

Check for the status of the deployment using the command brc observe, you should see a new xapp named ts.dynxapp-flexric.handover in the list of deployed xApps. Please wait until the xApp is in the 1/1 Y state, which indicates that it has been successfully deployed and is running.

Now you can modify the ue_id, preference, and ncI fields in the rApp to test and run the rApp again.

tip

Check the xApp logs with brc extract logs ts.dynxapp-flexric.handover to inspect the handover process. The ue_id is the RAN UE ID. You can find it in the xApp logs or in the DU logs with brc extract logs oai-gnb-du.oai-gnb-cu-du.handover and brc extract logs oai-gnb-du.oai-gnb-du.handover. The ncI value (NR Cell Identity) is defined in the an-id field of the YAML file. In this lab, you can use 20 or 50 as the target cell ID.

Uninstall

To uninstall the network and policy job, use the following command:

brc remove network ho-net.yaml
brc remove policyjob handover1

Checking via the brc observe command, you should see that all the elements and rApp jobs are removed.

💬 Questions

  1. Explain how the rApp, Non-RT RIC, Near-RT RIC, xApp, and gNB interact to enforce a traffic steering policy in this lab.
  2. Why does the traffic steering rApp need the ue_id and ncI values, and where can you find them during the experiment?
  3. Change the preference value in the rApp to FORBID and run the rApp again. What happens to the UE's connection, and how does the xApp respond to this policy change?
  4. Modify the traffic steering policy to hand over the UE to the other target cell, then verify the result from the xApp or DU logs.