Skip to main content
Version: v4.0.0 [Denim]

Lab 4: Monitoring rApp

In this lab, you will deploy a 5G Standalone (SA) network using the OpenAirInterface (OAI) RF Simulator for the gNB and the OAI minimal 5G Core (5GC).

In the second phase of the experiment, you will use the BubbleRAN rApp SDK (Monitoring service) to deploy two MonitoringJob objects to collect real-time metrics from the MAC and RLC layers via the E2 interface. Each job automatically initiates a corresponding xApp. Collected data is stored in a MySQL and Victoria Metrics databases inside the cluster.

caution

The MonitoringJob feature is under development and subject to change.

open-ran.yaml
apiVersion: athena.trirematics.io/v1
kind: Network
metadata:
name: oran
namespace: trirematics
spec:
slices:
- plmn: "00101"
dnn: internet
network-mode: IPv4
service-type: 1
differentiator: 0x000001
ipv4-range: "12.1.1.0/24"
ipv6-range: "2001:1:2::/64"
access:
- name: oai-gnb
stack: 5g-sa
model: oai-ran/monolithic-gnb
radio:
device: rf-sim
identity:
an-id: 10
tracking-area: 1
cells:
- band: n78
arfcn: 641280
bandwidth: 40MHz
subcarrier-spacing: 30kHz
tdd-config:
period: 5ms
dl-slots: 7
dl-symbols: 6
ul-slots: 2
ul-symbols: 4
core-networks:
- oai-5gc.oran
controller: ric.oran
core:
- name: oai-5gc
stack: 5g-sa
model: oai-cn/minimal
identity:
region: 0
cn-group: 4
cn-id: 5
edge:
- name: ric
stack: 5g-sa
model: mosaic5g/flexric
- name: sdl
stack: 5g-sa
model: mosaic5g/xapps-sdl
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/nr-rfsim
preferred-access: oai-gnb.oran
target-cores:
- oai-5gc.oran
identity:
imsi: "001010000000001"
pin: "1234"
opc: "0xc42449363bbad02b66d16bc975d77cc1"
key: "0xfec86ba6eb707ed08905757b1bb44b8f"
sqn: "0xff9bb4000001"
slice:
dnn: internet
network-mode: IPv4
service-type: 1
differentiator: 0x000001
radio:
bands:
- n78
readiness-check:
method: ping
target: google-ip
interface-name: oaitun_ue0

Network Deployment

Deploy the file using the command brc install network open-ran.yaml.

tip

The open-ran.yaml file does not include the xApp. The xApps will be deployed automatically by the SMO once the MonitoringJob objects are created.

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 monitoring rApp, test UE connectivity:

brc test rtt ue1 gateway -- -c 3

Monitoring rApp

mon-rapp.py
from br_rapp_sdk import MonitoringServices
from br_rapp_sdk.monitoring_services.monitoring_types import *
import time

if __name__ == "__main__":

# Initialize the A1Services
monitoring_services = MonitoringServices()

# Define the monitoring information for MAC layer
mac_monitoring_info = MonitoringObjectInformation(
target="ric.oran",
monitoringTypeId="mosaic5g/monitoring-c-mysql",
monitoringObject=MonitoringObject(
monitoringStatements=MonitoringStatements(
serviceModels=[
ServiceModel(name="MAC", periodicity="1000")
],
database=DatabaseType(
sqlDatabase = SqlDatabase(dbName="test_mac_db")
)
)
)
)

# Define the monitoring information for RLC layer
rlc_monitoring_info = MonitoringObjectInformation(
target="ric.oran",
monitoringTypeId="mosaic5g/monitoring-c",
monitoringObject=MonitoringObject(
monitoringStatements=MonitoringStatements(
serviceModels=[
ServiceModel(name="RLC", periodicity="1000")
],
database=DatabaseType(
victoriaMetrics=VictoriaMetricsDatabase(scenario="test_rlc_scenario"),
)
)
)
)

# Print the monitoring information in YAML format
print("MAC Monitoring Object Information: \n", mac_monitoring_info.yaml())
print("RLC Monitoring Object Information: \n", rlc_monitoring_info.yaml())

# Apply the MAC monitoring object
mac_monitoring_name = "mac-monitoring"
mac_result = monitoring_services.apply_monitoring(
monitoring_name=mac_monitoring_name,
monitoring_object=mac_monitoring_info
)
# Check if the MAC monitoring object was applied successfully
if mac_result.status == 'success':
mac_monitoring_id = mac_result.data.get('monitoring_id')
print(f"MAC Monitoring Object applied successfully: {mac_monitoring_id}")
else:
print(f"Error applying MAC Monitoring Object: {mac_result.error}")
exit(1)

# Apply the RLC monitoring object
rlc_monitoring_name = "rlc-monitoring"
rlc_result = monitoring_services.apply_monitoring(
monitoring_name=rlc_monitoring_name,
monitoring_object=rlc_monitoring_info
)
# Check if the RLC monitoring object was applied successfully
if rlc_result.status == 'success':
rlc_monitoring_id = rlc_result.data.get('monitoring_id')
print(f"RLC Monitoring Object applied successfully: {rlc_monitoring_id}")
else:
print(f"Error applying RLC Monitoring Object: {rlc_result.error}")
exit(1)

# Wait until both monitoring objects are "Running"
while True:
mac_status = monitoring_services.get_monitoring_status(monitoring_id=mac_monitoring_id)
rlc_status = monitoring_services.get_monitoring_status(monitoring_id=rlc_monitoring_id)

mac_phase = mac_status.data.get('status', {}).get('phase') if mac_status.status == 'success' else 'error'
rlc_phase = rlc_status.data.get('status', {}).get('phase') if rlc_status.status == 'success' else 'error'

print(f"MAC status: {mac_phase}")
print(f"RLC status: {rlc_phase}")

if mac_phase == "Running" and rlc_phase == "Running":
print("Both MAC and RLC Monitoring Objects are Running.")
break

time.sleep(3)

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

python3 ./mon-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 two new xapp named monitoring-c.dynxapp2fde90-ric.oran for RLC and monitoring-c-mysql.dynxapp3b65c0-ric.oran for MAC in the list of deployed xApps. Please wait until both are in the 1/1 Y state, which indicates that they have been successfully deployed and are running.

For fetching the collected data, you can use the mon-fetch-rapp.py script which uses the rApp SDK to query the delivery endpoints for both MAC and RLC monitoring jobs.

mon-fetch-rapp.py
from br_rapp_sdk import MonitoringServices
from br_rapp_sdk.monitoring_services.monitoring_types import *
import time

if __name__ == "__main__":

# Initialize the A1Services
monitoring_services = MonitoringServices()


# Fetch the delivery endpoint for MAC monitoring from the sql database
mac_endpoint = monitoring_services.get_delivery_endpoint(monitoring_id="mac-monitoring")
if mac_endpoint.status == 'success':
print(f"MAC Delivery Endpoint: {mac_endpoint.data.get('endpoint')}")
else:
print(f"Error fetching MAC delivery endpoint: {mac_endpoint.error}")
exit(1)

sql_query = """
SELECT *
FROM MAC_UE
ORDER BY tstamp DESC
LIMIT 10;
"""

# Fetch data from the MAC monitoring endpoint
mac_data_result = monitoring_services.fetch_data_from_endpoint(
endpoint=mac_endpoint.data.get("endpoint", {}),
query=sql_query
)
if mac_data_result.status == 'success':
mac_data = mac_data_result.data.get("data", [])
print("Fetched MAC Data:")
for row in mac_data:
print(row)
else:
print(f"Error fetching MAC data: {mac_data_result.error}")
exit(1)

# Fetch the delivery endpoint for RLC monitoring from the victoria metrics database
rlc_endpoint = monitoring_services.get_delivery_endpoint(monitoring_id="rlc-monitoring")
if rlc_endpoint.status == 'success':
print(f"RLC Delivery Endpoint: {rlc_endpoint.data.get('endpoint')}")
else:
print(f"Error fetching RLC delivery endpoint: {rlc_endpoint.error}")
exit(1)

vm_query = """{sm="rlc"}"""
# Fetch data from the RLC monitoring endpoint
rlc_data_result = monitoring_services.fetch_data_from_endpoint(
endpoint=rlc_endpoint.data.get("endpoint", {}),
query=vm_query
)
if rlc_data_result.status == 'success':
rlc_data = rlc_data_result.data.get("data", [])
print("Fetched RLC Data:")
print(rlc_data)
else:
print(f"Error fetching RLC data: {rlc_data_result.error}")
exit(1)
python3 ./mon-fetch-rapp.py

Uninstall

To uninstall the network and monitoring jobs, use the following command:


brc remove network open-ran.yaml
brc remove monitoringjob mac-monitoring
brc remove monitoringjob rlc-monitoring

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

💬 Questions

  1. What MAC-layer metrics are collected by the monitoring rApp?
  2. What RLC-layer metrics are collected by the monitoring rApp?
  3. Can the rApp perform monitoring without an xApp? Why or why not?
  4. Extend the experiment by modifying the MonitoringJob definition to use both MAC and RLC service models in a single job. What differences do you observe compared to deploying them in separate jobs?