An xApp for the O-RAN SC near-real-time RIC that turns an A1 policy into an inter-gNB Xn handover on the RAN, over the E2 interface.
A non-real-time RIC application decides which user equipment should move where and expresses that as an A1 policy. This xApp receives the policy, encodes an E2SM-RC RIC Control Request (RIC Control Style 3 "Connected Mode Mobility", Control Action 1 "Handover Control"), sends it to the source gNB, and reports the gNB's answer back on A1.
rApp ──A1 policy (REST)──▶ A1 Mediator ──RMR 20010──▶ Handover xApp
│
pre-flight: E2 Manager + E2SM-KPM
│
RMR 12040 (RIC Control Request)
▼
E2 Termination
│ E2AP / SCTP
▼
source gNB
│ XnAP
▼
target gNB
│
rApp ◀──A1 response──── xApp ◀──RMR 12041 / 12042 (Control Acknowledge / Failure)
The A1 response is only sent once the gNB has answered, so a handover the RAN rejects is reported as a failure rather than a success.
Policy type 20100 by default. The payload:
{
"amf_ue_ngap_id": 1,
"target_nr_cell_id": "0x000001",
"plmn": "00101",
"gnb_cu_ue_f1ap_id": 1,
"e2_node_id": "gnb_<plmn>_<gnb-id>"
}| Field | Required | Meaning |
|---|---|---|
amf_ue_ngap_id |
yes | Identifies the user equipment at the CU-CP. Integer, 0 .. 2^40-1 per TS 38.413 §9.3.3.1 |
target_nr_cell_id |
yes | 36-bit NR Cell Identity of the target cell. Hex string or integer |
plmn |
yes | Must match the RAN's PLMN |
gnb_cu_ue_f1ap_id |
no | Defaults to amf_ue_ngap_id |
e2_node_id |
no | Defaults to the one CONNECTED E2 node that offers E2SM-RC handover control (style 3, action 1). Required when several gNBs are connected. A DU or CU-UP node is rejected with the name of its gNB's CU-CP node |
The xApp replies on A1_POLICY_RESP (RMR 20011) with status of OK or ERROR.
An ERROR carries a reason naming what actually went wrong — the source gNB not
being connected, a stale E2 association, the RAN rejecting the control, or no answer
from the RAN within the timeout.
Create the policy type and an instance through the A1 Mediator:
A1=http://<ric-host>:<a1-nodeport>/A1-P/v2
curl -X PUT "$A1/policytypes/20100" -H 'Content-Type: application/json' -d @policy-type.json
curl -X PUT "$A1/policytypes/20100/policies/ho-1" -H 'Content-Type: application/json' -d '{
"amf_ue_ngap_id": 1,
"target_nr_cell_id": "0x000001",
"plmn": "00101"
}'- An E2 agent connected to the RIC, advertising E2SM-RC (OID
1.3.6.1.4.1.53148.1.1.2.3). The RAN function id is discovered by OID, never assumed. - The target cell configured as a neighbour of the source cell, with an Xn link between the two gNBs.
- Optionally E2SM-KPM (OID
1.3.6.1.4.1.53148.1.2.2.2) if you want the subscription and pre-flight features below.
The xApp is onboarded with dms_cli and installed into the ricxapp namespace. See
BUILD.md.
cd init && dms_cli onboard --config_file_path=config-file.json --shcema_file_path=schema.json
dms_cli install --xapp_chart_name=handover-xapp --version=1.0.0 --namespace=ricxappThe image fetches RMR and riclibe2ap from the O-RAN SC package repository and
installs the O-RAN SC Python xApp framework at a pinned commit.
| Variable | Default | Meaning |
|---|---|---|
POLICY_TYPE_ID |
20100 |
A1 policy type this xApp handles |
E2MGR_URI |
http://service-ricplt-e2mgr-http.ricplt:3800 |
E2 Manager REST endpoint |
SUBMGR_URI |
http://service-ricplt-submgr-http.ricplt:8088/ric/v1 |
Subscription Manager REST endpoint |
RMR_SRC_ID |
container hostname | Identity announced to RMR. Must match the RMR Service name or sends are dropped silently, see BUILD.md |
RAN_FUNC_ID |
discovered by OID | Override the E2SM-RC RAN function id |
KPM_SUBSCRIBE |
false |
Subscribe to E2SM-KPM on every connected E2 node |
KPM_REPORT_PERIOD_MS |
10000 |
Reporting period |
KPM_GRANULARITY_MS |
10000 |
Granularity period |
KPM_METRICS |
RRC.ConnMean,RRC.ConnMax,RRC.ConnEstabAtt |
Measurements to request from a gNB / CU-CP node (gnb_...) |
KPM_METRICS_DU |
RRU.PrbUsedDl,RRU.PrbUsedUl,RRU.PrbAvailDl,DRB.UEThpDl,DRB.UEThpUl |
Measurements to request from a DU node (gnbd_...) |
KPM_METRICS_CU_UP |
DRB.PacketSuccessRateUlgNBUu,DRB.PdcpReordDelayUl |
Measurements to request from a CU-UP node (gnbc_...) |
KPM_RETRY_MAX_S |
600 |
Longest wait between retries of a failed subscription (30 s, doubling) |
KPM_UE_SUBSCRIBE |
true |
Also subscribe to UE-level measurements on nodes that offer them (needs KPM_SUBSCRIBE=true) |
KPM_UE_STYLE |
4 |
E2SM-KPM report style for UE-level measurements: 2 (one UE), 3 (condition per metric), 4 (all UEs matching a condition), 5 (a list of UEs) |
KPM_METRICS_UE |
DRB.UEThpDl,DRB.UEThpUl,DRB.RlcSduTransmittedVolumeDL,DRB.RlcSduTransmittedVolumeUL |
UE-level measurements; names not offered in the chosen style are left out |
KPM_UE_CONDITION |
ul-rSRP:lessthan:1000 |
Style 4 test condition, type[:expression[:integer]] |
KPM_UE_IDS |
empty | Styles 2 and 5: gNB-CU-UE-F1AP-ID values, comma separated |
APPMGR_URI |
http://service-ricplt-appmgr-http.ricplt:8080 |
App Manager REST endpoint |
XAPP_REGISTER |
true |
Check every 30 s that the App Manager lists the xApp, and register again if it was lost |
XAPP_HTTP_ENDPOINT, XAPP_RMR_ENDPOINT |
unset | Endpoints used when registering again; without them the xApp only reports the loss |
XAPP_DESCRIPTOR |
config-file.json next to ho_xapp.py |
Descriptor sent with the registration; the chart mounts it at /opt/ric/config/config-file.json |
SUBSCRIPTION_CLIENT_HOST |
RMR_SRC_ID with -rmr. replaced by -http. |
Host the Subscription Manager calls back; it derives the RMR endpoint by replacing http with rmr |
RMR_SEED_RT |
/opt/route/route.rt |
Seed RMR route table, used until the Routing Manager sends the real routes |
PREFLIGHT |
true |
Check the node before sending a control |
PREFLIGHT_MAX_AGE_S |
3 report periods | Reject if the last report is older than this |
CONTROL_AWAIT |
true |
Wait for the gNB's answer before replying on A1 |
CONTROL_TIMEOUT_S |
5 |
How long to wait for that answer |
LOG_LEVEL |
INFO |
DEBUG, INFO, WARNING or ERROR |
RMR_LOG_VLEVEL |
unset | 0 silences the RMR library's periodic statistics, which otherwise dominate the log |
Command line: --config, --http_server_port (default 8090; the descriptor runs it on 8091),
--rmr_port (default 4560), --policy_type_id.
| Endpoint | Purpose |
|---|---|
GET /ric/v1/cells |
Latest measurements per E2 node, from E2SM-KPM indications |
GET /ric/v1/subscriptions |
Subscription state per node |
GET /ric/v1/xapp/health |
Liveness, active and failed subscriptions, indication counters, App Manager registration |
GET /ric/v1/ues |
Latest UE-level measurements per UE (gNB-CU-UE-F1AP-ID), with the subscription plan |
GET /ric/v1/e2nodes |
Every CONNECTED E2 node with its role, gNB, RAN function ids, KPM report styles and metrics, RC control styles, and whether it can take a handover |
A gNB can open one E2 association per unit. OCUDU does this from a single ./gnb
process when enable_cu_cp_e2, enable_du_e2 and enable_cu_up_e2 are set, and the RIC
then shows three nodes for one gNB:
| E2 Manager name | gnbNodeType |
Offers (OCUDU) |
|---|---|---|
gnb_<plmn>_<gnb-id> |
gNB |
KPM style 1 (9 RRC metrics), RC control style 3 / action 1 (handover) |
gnbd_<plmn>_<gnb-id>_<du-id> |
gNB_DU |
KPM styles 1-5 (15 metrics: PRB, throughput, RLC), RC control style 2 / action 6 |
gnbc_<plmn>_<gnb-id>_<cu-up-id> |
gNB_CU_UP |
KPM style 1 (2 PDCP metrics) |
The xApp reads each node's role and decodes its RAN function definitions from the E2 Manager,
sends handovers only to a node that offers RC style 3 / action 1, and asks each node only for
the measurements it offers. The A1 answer carries the measurements of the other units of the
same gNB under ran.same_gnb. OCUDU names an RC parameter >CHOICE Target Cell, and >
is not a PrintableString character, so the RC definition is decoded with that one field read as
IA5String, which has the same aligned-PER encoding for these characters.
With KPM_SUBSCRIBE=true the xApp subscribes to E2SM-KPM report style 1 on every
connected E2 node, retrying every 30 seconds and re-subscribing after a node
reconnects. Indications are decoded into a per-node measurement table served by
GET /ric/v1/cells.
Before sending a control the xApp checks that the source gNB is CONNECTED in the
E2 Manager and, when subscriptions are enabled, that its last measurement report is
recent. A stale association is reported as such instead of a handover that vanishes.
Set PREFLIGHT=false to skip the check.
A subscription counts as active only when the Subscription Manager's notification carries a
non-zero E2EventInstanceId; zero means it failed, and it is retried after 30 s, doubling up
to KPM_RETRY_MAX_S. A subscription that gets no answer within 60 s, or no RIC Indication for
PREFLIGHT_MAX_AGE_S, is deleted and made again. A node that re-runs E2 Setup or changes its
RAN functions is subscribed again. The subscriptions are deleted when the xApp is stopped with
SIGTERM.
E2SM-KPM report styles 2 to 5 give measurements per UE. OCUDU offers them on the DU node
only, and names each UE as gNB-DU-UEID / gNB-CU-UE-F1AP-ID, the same identifier the
handover policy takes as gnb_cu_ue_f1ap_id. The xApp subscribes with the style in
KPM_UE_STYLE on every node that lists that style, next to its style 1 subscription, and
serves the result at GET /ric/v1/ues. The A1 answer lists the UEs the same gNB reported
under ran.ues_reported.
| Style | Action / indication format | Use |
|---|---|---|
| 2 | 2 / 1 | One subscription per id in KPM_UE_IDS |
| 3 | 3 / 2 | One condition per metric (no-label match) |
| 4 | 4 / 3 | All UEs that match KPM_UE_CONDITION; the default |
| 5 | 5 / 3 | The UEs in KPM_UE_IDS |
Behaviour of OCUDU:
- Test conditions are accepted but not evaluated; styles 3 and 4 report every UE with RLC activity. The default condition (UL RSRP below 1000) matches every UE either way.
- Indications are sent only while at least one UE is reported, so a UE-level subscription that stays silent is not treated as broken.
- Style 3 fills only the first condition that has UEs, so it reports one metric per indication.
- In styles 4 and 5,
RRU.PrbUsed*,RRU.PrbTot*andDRB.AirIfDelayUlcome from the scheduler while the UE list comes from RLC; for a moment after a UE leaves the gNB can index past its value list. The default metrics are RLC metrics only; the xApp warns when one of these is configured.
UEs not reported for three report periods (at least 30 s) are dropped from /ric/v1/ues.
Files written by coRAN LABS (the code under src/, the Dockerfile and the config under
init/) are Apache-2.0. The .asn files under
src/lib/asn1 are transcriptions of O-RAN Alliance specifications. See NOTICE
for the file-by-file breakdown and the third-party components fetched at build time.