uric

An O-RAN near‑RT RIC in pure Python

uric terminates E2 from real or simulated gNBs, decodes KPM and RC, and runs xApps written against the OSC Python xApp API. One dependency, no containers, no RMR.

git clone https://github.com/openwiran/uric
  • Python ≥ 3.9standard library
  • pycratethe only dependency
  • Apache 2.0license
One E2 control loop, end to end
E2 message sequence through uric A gNB sets up E2 with uric. An xApp subscribes to KPM reports, receives an indication through a callback, and sends an RC slice PRB quota control that the gNB acknowledges. xApp uric gNB SCTP :36421 TCP :4560 E2 Setup Request E2 Setup Response subscribe_report_service_style_4() RIC Subscription Request RIC Subscription Response RIC Indication (KPM format 3) callback(e2_agent_id, …) control_slice_level_prb_quota() RIC Control Request RIC Control Acknowledge {"success": true}

Scroll sideways to see the gNB lane.

Follows the O-RAN WG3 specifications

The codecs are compiled from the published ASN.1 modules, so what goes on the wire is standard APER that real E2 nodes understand.

E2AP v3+, SCTP :36421, PPID 70
E2 Setup, Service Update and Query, Node Configuration Update, Subscription and Delete, Indication, Control, Reset, Removal and Error Indication.
E2SM-KPM v03.00
Every report style (1–5) and every indication format (1–3), with all metrics of format 2 decoded.
E2SM-RC v01.03
Control format 1 with outcome decoding, report subscriptions, insert replies, and full RAN function definition decoding, RAN parameter trees included.
Many nodes, many UEs
A UE registry built from KPM and RC reports tracks each UE's identity, serving node and cell, and latest metrics.
Offline dashboard
Plain HTML, CSS and JS served by the RIC. It loads nothing from the internet and follows the REST API and a live SSE event stream.
E2 node simulator
uric-sim starts gNBs with UEs that speak KPM and RC, for development and for the end-to-end tests.

From clone to live KPIs

The RIC starts no xApp on its own: it learns about UEs and KPIs only through the subscriptions xApps make. The bundled kpm-monitor xApp subscribes to everything on every node.

  1. Install

    Create a virtual environment and install the package. This pulls in pycrate.

    python3 -m venv .venv && . .venv/bin/activate
    git clone https://github.com/openwiran/uric && cd uric
    pip install -e .
  2. Start the RIC with the KPM monitor

    The dashboard opens at http://localhost:8080. The xApp can also run as its own process.

    uric --xapp uric.xapps.kpm_monitor
    # or, as a separate process
    python -m uric.xapps.kpm_monitor --ric 127.0.0.1:4560
  3. Connect three simulated gNBs

    Each one brings four UEs. They appear in the dashboard topology within a reporting period.

    uric-sim --nodes 3 --ues 4

Write xApps the way you already do

Class names, method names, callback arguments and decoded dict layouts match the OSC Python xApp framework, so existing xApps port with very few changes.

from uric.xapp import xAppBase

class SliceGuard(xAppBase):

    def on_report(self, e2_agent_id, sub_id, hdr, msg):
        meas = self.e2sm_kpm.extract_meas_data(msg)
        for ue, data in meas["ueMeasData"].items():
            if data["measData"]["RSRP"][-1] < -110:
                self.e2sm_rc.control_slice_level_prb_quota(
                    e2_agent_id, ue, min_prb_ratio=10,
                    max_prb_ratio=50, dedicated_prb_ratio=100)

    @xAppBase.start_function
    def start(self, e2_node_id, metrics):
        conds = [{"testCondInfo": {
            "testType": ("sNSSAI", "true"),
            "testExpr": "equal",
            "testValue": ("valueInt", 1)}}]
        self.e2sm_kpm.subscribe_report_service_style_4(
            e2_node_id, 1000, conds, metrics, 1000,
            self.on_report)

SliceGuard("").start("gnb_00101_e00", ["RSRP"])

Porting from the OSC framework

  • The constructor is xAppBase(config, ric_address). Drop the RMR and HTTP port arguments.
  • RAN function IDs are discovered from E2 Setup.
  • Control calls wait for the acknowledgement and return {"success", "cause", "outcome"}.
  • get_e2_nodes() and get_ues() expose RIC state and node capabilities.

RC controls built in

  • Slice-level PRB quota (style 2, action 6)
  • Handover by any UE identifier (style 3, action 1)
  • Any other action through a {id: value} RAN parameter tree

As a separate process

Run the script. It connects to the RIC's xApp interface on TCP 4560, which takes the place of RMR and the subscription manager. When it disconnects, its subscriptions are deleted.

URIC_RIC=10.0.0.5:4560 python my_xapp.py

Inside the RIC

Ship it as an ordinary Python package with an entry point. The RIC starts it in its own thread, and the dashboard can start and stop it. The xApp code is the same.

[project.entry-points."uric.xapps"]
my-xapp = "my_xapp.app:MyXapp"

See what every node can do

The dashboard decodes each RAN function definition, so you can read a node's KPM metrics and RC control styles before writing a line of xApp code. Everything it shows is also in the REST API.

  • OverviewCounters, an E2 topology graph from RIC to nodes to UEs, and recent events
  • E2 nodesIdentity, transport, E2AP statistics, decoded KPM and RC capabilities, KPI sparklines, plus Service Query, Reset and Removal
  • UEsServing node and cell, latest KPM metrics with trends, and RC parameters
  • SubscriptionsOwner xApp, style, state and indication count, each one deletable
  • xAppsEmbedded and remote xApps with their configuration and live status
  • EventsThe live platform event log over SSE

E2AP procedure support

Procedures that are not implemented are answered with an Error Indication, so a node never waits on a silent RIC.

Direction is given from the point of view of the E2 node and the RIC.
ProcedureDirectionSupport
E2 Setupnode to RICRAN functions, component configuration, setup failure
RIC Service Update / QuerybothSupported
E2 Node Configuration Updatenode to RICAdd, update and remove acknowledgements
RIC Subscription / DeleteRIC to nodeAdmitted and not-admitted actions
RIC Subscription Delete Requirednode to RICTriggers deletion
RIC Indicationnode to RICReport and insert, decoded per service model
RIC ControlRIC to nodeAck and noAck, outcome decoding, call process ID
Reset, E2 RemovalbothSupported
Error IndicationbothSupported
Subscription Modification, Query, Audit, E2 Connection UpdatenoneNot implemented

Known limits

Worth knowing before you point a production gNB at it.

  • RC format 2 has no builderMulti-action control headers and messages decode, but you build the payload yourself and send it with send_control_request().
  • One association per nodeThe SCTP transport uses one-to-one sockets with a single association per E2 node and no multi-homing.
  • REAL values in base 2pycrate's base-10 encoder is unreliable, so uric encodes in base 2. Decoding accepts both.

Run a RIC on your laptop today

Clone the repository, start the RIC and the simulator, and watch indications arrive in the dashboard. The test suite runs the RIC, simulator, xApps and API end to end.