xdevsm 0.1.0__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xdevsm-0.1.0 → xdevsm-0.1.1}/PKG-INFO +1 -1
- xdevsm-0.1.1/VERSION +1 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/__init__.py +1 -0
- xdevsm-0.1.1/src/xdevsm/decorators/rc/rc_report_frame.py +108 -0
- xdevsm-0.1.1/src/xdevsm/sm_framework/lib/librc_1_03.so +0 -0
- xdevsm-0.1.1/src/xdevsm/sm_framework/py_oran/rc/rc_report_codec.py +194 -0
- xdevsm-0.1.0/VERSION +0 -1
- xdevsm-0.1.0/src/xdevsm/sm_framework/lib/librc_1_03.so +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/.gitignore +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/LICENSE +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/README.md +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/pyproject.toml +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/base.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/ccc/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/ccc/ccc_frame.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/control.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/dApp/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/dApp/control/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/dApp/control/dapp_prb_mask_control.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/dApp/report/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/dApp/report/dapp_report.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/kpm/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/kpm/kpm_frame.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/no_op_dec.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/rc/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/rc/rc_connected_mode_mobility.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/rc/rc_radio_bearer_control.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/rc/rc_radio_resource_alloc_control.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/decorators/report.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/handlers/I_xDevSM_xapp.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/handlers/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/handlers/config.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/handlers/xDevSM_rmr_xapp.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/README.md +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/lib/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/lib/libdapp_sm.so +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/lib/libkpm_sm.so +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/lib/libkpm_sm_2_01.so +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/lib/library_wrapper.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/lib/libsm_framework.so +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/ByteArray.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/ccc/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/ccc/ccc_decoder.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/ccc/ccc_encoder.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/ccc/constants.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlHdr.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlMsg.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlOut.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlReq.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/control/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/e3/DAppE3CtrlPayload.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/e3/DAppE3IndPayload.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/e3/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/enums.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/report/DAppActionDef.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/report/DAppEvTrigger.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/report/DAppFunctionDef.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/report/DAppIndicationHdr.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/report/DAppIndicationMsg.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/report/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/kpm/KpmFunctionDef.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/kpm/KpmIndicationHdr.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/kpm/KpmIndicationMsg.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/kpm/MeasData.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/kpm/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/kpm/enums.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/kpm/function_definition_builder.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/rc/RCControlHdr.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/rc/RCControlMsg.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/rc/RCControlReq.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/rc/RCFunctionDef.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/rc/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/rc/enums.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/utils/__init__.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/utils/constants.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/utils/lat_profile.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/utils/utility.py +0 -0
- {xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/utils/xapp_sub.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: xdevsm
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: An SDK framework for building O-RAN xApps over E2 Service Models (KPM, RC, CCC).
|
|
5
5
|
Project-URL: Homepage, https://openrangym.com/tutorials/xdevsm-tutorial
|
|
6
6
|
Project-URL: Package, https://pypi.org/project/xdevsm/
|
xdevsm-0.1.1/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.1
|
|
@@ -23,6 +23,7 @@ _LAZY = {
|
|
|
23
23
|
"BaseXDevSMWrapper": "xdevsm.decorators.base:BaseXDevSMWrapper",
|
|
24
24
|
"XappKpmFrame": "xdevsm.decorators.kpm.kpm_frame:XappKpmFrame",
|
|
25
25
|
"XappCccFrame": "xdevsm.decorators.ccc.ccc_frame:XappCccFrame",
|
|
26
|
+
"XappRcReportFrame": "xdevsm.decorators.rc.rc_report_frame:XappRcReportFrame",
|
|
26
27
|
"RadioBearerControl": "xdevsm.decorators.rc.rc_radio_bearer_control:RadioBearerControl",
|
|
27
28
|
"RadioResourceAllocationControl": "xdevsm.decorators.rc.rc_radio_resource_alloc_control:RadioResourceAllocationControl",
|
|
28
29
|
"ConnectedModeMobilityControl": "xdevsm.decorators.rc.rc_connected_mode_mobility:ConnectedModeMobilityControl",
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"""E2SM-RC REPORT Style 1 "Message Copy" report decorator.
|
|
2
|
+
|
|
3
|
+
Mirrors ``XappKpmFrame``/``XappCccFrame`` (subscribe -> receive indications ->
|
|
4
|
+
decode -> callback), but for E2SM-RC REPORT Service Style 1 "Message Copy": it
|
|
5
|
+
subscribes so the gNB copies the UE's UL-DCCH RRC MeasurementReport to the xApp,
|
|
6
|
+
decodes the neighbour-cell measurements from it, and hands them to the registered
|
|
7
|
+
callback (the data ingestor writes them to ``ue-neighbor-meas``).
|
|
8
|
+
|
|
9
|
+
The E2SM-RC + NR-RRC decode/encode lives in ``rc_report_codec``, backed by the
|
|
10
|
+
``rc_report_*`` ABI of the bundled ``librc_1_03.so``. Against an older library that
|
|
11
|
+
does not export it, ``subscribe`` raises RuntimeError -- the data ingestor guards
|
|
12
|
+
the call so KPM/dApp/CCC ingestion is unaffected.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from xdevsm.decorators.report import xAppReportService
|
|
16
|
+
|
|
17
|
+
from ricxappframe.xapp_frame import rmr
|
|
18
|
+
|
|
19
|
+
from xdevsm.utils.constants import Values
|
|
20
|
+
|
|
21
|
+
from xdevsm.sm_framework.py_oran.rc.rc_report_codec import (
|
|
22
|
+
RC_REPORT_STYLE_MESSAGE_COPY,
|
|
23
|
+
decode_meas_report,
|
|
24
|
+
encode_report_subscription,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class XappRcReportFrame(xAppReportService):
|
|
29
|
+
"""RC REPORT "Message Copy" decorator (RAN function id 3)."""
|
|
30
|
+
|
|
31
|
+
def __init__(self, xapp_handler, logger, server, xapp_name,
|
|
32
|
+
rmr_port, http_port, pltnamespace, app_namespace):
|
|
33
|
+
super().__init__(xapp_handler, logger, server, xapp_name,
|
|
34
|
+
rmr_port, http_port, pltnamespace, app_namespace)
|
|
35
|
+
self.function_id = 3 # E2SM-RC
|
|
36
|
+
|
|
37
|
+
# -- indication path -----------------------------------------------------
|
|
38
|
+
def handle(self, xapp, summary, sbuf):
|
|
39
|
+
xapp.logger.debug("[XappRcReportFrame] received: {}".format(summary))
|
|
40
|
+
if summary[rmr.RMR_MS_MSG_TYPE] == Values.RIC_INDICATION:
|
|
41
|
+
self._handle_indication(xapp, summary)
|
|
42
|
+
elif summary[rmr.RMR_MS_MSG_TYPE] == Values.RIC_ERROR_INDICATION:
|
|
43
|
+
xapp.logger.error("[XappRcReportFrame] Error in indication message")
|
|
44
|
+
# delegate down the decorator chain (KPM/dApp/CCC still get their turn)
|
|
45
|
+
self._xapp_handler.handle(xapp, summary, sbuf)
|
|
46
|
+
|
|
47
|
+
def decode_message(self, function_id, ba_ind_header, ba_ind_msg, meid, sub_id):
|
|
48
|
+
if function_id != self.function_id:
|
|
49
|
+
self.logger.debug(
|
|
50
|
+
"[XappRcReportFrame] indication for different function id: {}".format(function_id))
|
|
51
|
+
return
|
|
52
|
+
|
|
53
|
+
try:
|
|
54
|
+
decoded = decode_meas_report(ba_ind_header, ba_ind_msg)
|
|
55
|
+
except Exception as e:
|
|
56
|
+
self.logger.error("[XappRcReportFrame] failed to decode RC/MeasReport indication: {}".format(e))
|
|
57
|
+
return
|
|
58
|
+
|
|
59
|
+
if not decoded.is_meas_report:
|
|
60
|
+
# A copied RRC message that was not a MeasurementReport (or failed the
|
|
61
|
+
# inner decode) -- nothing to store.
|
|
62
|
+
self.logger.debug(
|
|
63
|
+
"[XappRcReportFrame] RC message copy (ev_trigger_id={}) was not a MeasurementReport".format(
|
|
64
|
+
decoded.ev_trigger_id))
|
|
65
|
+
return
|
|
66
|
+
|
|
67
|
+
callback = self.get_indication_msg_callback()
|
|
68
|
+
if callback is None:
|
|
69
|
+
self.logger.info(
|
|
70
|
+
"[XappRcReportFrame] no callback; {} neighbour meas dropped".format(
|
|
71
|
+
len(decoded.get_neighbor_measurements())))
|
|
72
|
+
return
|
|
73
|
+
# Same callback signature as KPM/CCC: (ind_hdr, ind_msg, meid, sub_id).
|
|
74
|
+
callback(ba_ind_header, decoded, meid, sub_id)
|
|
75
|
+
|
|
76
|
+
# -- subscription path ---------------------------------------------------
|
|
77
|
+
def subscribe(self, gnb, ran_period_ms: int = 1000, action_type=Values.ACTION_TYPE):
|
|
78
|
+
"""Subscribe to REPORT Style 1 "Message Copy" of the UL-DCCH
|
|
79
|
+
MeasurementReport for ``gnb``. Returns the submgr subscription id."""
|
|
80
|
+
self.logger.info(
|
|
81
|
+
"[XappRcReportFrame] Preparing RC REPORT (Style {}) subscription for gnb: {}".format(
|
|
82
|
+
RC_REPORT_STYLE_MESSAGE_COPY, gnb.inventory_name))
|
|
83
|
+
|
|
84
|
+
if self.subscriber.ResponseHandler(self.subs_response_cb, self.server) is not True:
|
|
85
|
+
self.logger.error("Error when trying to set the subscription response callback")
|
|
86
|
+
|
|
87
|
+
# Encode the event trigger (Message Event -> MeasurementReport) and the
|
|
88
|
+
# REPORT Style 1 action definition (RAN param 'RRC Message').
|
|
89
|
+
ev_trigger_enc, action_def_enc = encode_report_subscription(ran_period_ms=ran_period_ms)
|
|
90
|
+
|
|
91
|
+
action = self.subscriber.ActionToBeSetup(
|
|
92
|
+
action_id=1,
|
|
93
|
+
action_type=action_type,
|
|
94
|
+
action_definition=action_def_enc.byte_array_to_tuple(),
|
|
95
|
+
subsequent_action=self.subscriber.SubsequentAction(
|
|
96
|
+
subsequent_action_type="continue", time_to_wait="w5ms"),
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
result = self.send_subscription(gnb, ev_trigger_enc, [action])
|
|
100
|
+
if result is None:
|
|
101
|
+
return None
|
|
102
|
+
_, sub_id = result
|
|
103
|
+
return sub_id
|
|
104
|
+
|
|
105
|
+
def terminate(self, signum, frame):
|
|
106
|
+
# base xAppReportService unsubscribes this frame's subscriptions, then
|
|
107
|
+
# delegates termination down the chain.
|
|
108
|
+
super().terminate(signum, frame)
|
|
Binary file
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"""E2SM-RC REPORT Style 1 "Message Copy" codec + NR-RRC MeasurementReport decoder.
|
|
2
|
+
|
|
3
|
+
Thin ctypes binding over the ``rc_report_*`` ABI exported by the bundled
|
|
4
|
+
``librc_1_03.so`` (flexric's rc_sm plus ``rc_report_api.c``). That library does the
|
|
5
|
+
heavy lifting in C -- flexric's rc_sm codecs + the asn1c NR-RRC decoder -- and
|
|
6
|
+
exposes a flat ABI:
|
|
7
|
+
|
|
8
|
+
rc_report_ba_t rc_report_enc_event_trigger(void); // RIC SUBSCRIPTION event trigger
|
|
9
|
+
rc_report_ba_t rc_report_enc_action_def(void); // REPORT Style 1 action def (RAN param RRC Message)
|
|
10
|
+
rc_report_meas_t rc_report_decode(hdr,msg); // decode indication -> per-cell (pci,rsrp,rsrq,sinr)
|
|
11
|
+
void rc_report_free_ba/free_meas(...);
|
|
12
|
+
|
|
13
|
+
The library ships in ``xdevsm/sm_framework/lib/`` and is self-contained (it links
|
|
14
|
+
only libc/libm). Against an older, control-only build that does not export the
|
|
15
|
+
``rc_report_*`` symbols this module still imports -- encode/decode then raise
|
|
16
|
+
RuntimeError, which the data ingestor's guarded subscribe / decode paths log and
|
|
17
|
+
swallow (the feature stays optional).
|
|
18
|
+
|
|
19
|
+
Values come back already converted to physical units (dBm/dB) by the C side.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import ctypes
|
|
25
|
+
from typing import List, Optional, Tuple
|
|
26
|
+
|
|
27
|
+
from xdevsm.sm_framework.py_oran.ByteArray import ByteArray
|
|
28
|
+
from xdevsm.sm_framework.lib.library_wrapper import wrap_functions, rc_lib
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# REPORT Service Style 1 ("Message Copy"); RAN Parameter ID of the copied RRC msg.
|
|
32
|
+
RC_REPORT_STYLE_MESSAGE_COPY = 1
|
|
33
|
+
E2SM_RC_RS1_RRC_MESSAGE = 3
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# --- ctypes structs (must mirror rc_report.h) ------------------------------
|
|
37
|
+
|
|
38
|
+
class _RcReportCell(ctypes.Structure):
|
|
39
|
+
_fields_ = [
|
|
40
|
+
("pci", ctypes.c_int32),
|
|
41
|
+
("rsrp", ctypes.c_double),
|
|
42
|
+
("rsrq", ctypes.c_double),
|
|
43
|
+
("sinr", ctypes.c_double),
|
|
44
|
+
("has_rsrp", ctypes.c_int32),
|
|
45
|
+
("has_rsrq", ctypes.c_int32),
|
|
46
|
+
("has_sinr", ctypes.c_int32),
|
|
47
|
+
("is_neighbour", ctypes.c_int32),
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class _RcReportMeas(ctypes.Structure):
|
|
52
|
+
_fields_ = [
|
|
53
|
+
("ev_trigger_id", ctypes.c_int32),
|
|
54
|
+
("is_meas_report", ctypes.c_int32),
|
|
55
|
+
("len", ctypes.c_size_t),
|
|
56
|
+
("cells", ctypes.POINTER(_RcReportCell)),
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# --- library binding (optional: absent lib -> raise at call time) ----------
|
|
61
|
+
|
|
62
|
+
_UINT8_P = ctypes.POINTER(ctypes.c_uint8)
|
|
63
|
+
|
|
64
|
+
try:
|
|
65
|
+
# The RC REPORT helpers now live inside the RC SM library (librc_1_03.so),
|
|
66
|
+
# already loaded by library_wrapper as rc_lib -- no separate lib to load.
|
|
67
|
+
_report_lib = rc_lib
|
|
68
|
+
_enc_event_trigger = wrap_functions(_report_lib, "rc_report_enc_event_trigger", ByteArray, [])
|
|
69
|
+
_enc_action_def = wrap_functions(_report_lib, "rc_report_enc_action_def", ByteArray, [])
|
|
70
|
+
_free_ba = wrap_functions(_report_lib, "rc_report_free_ba", None, [ByteArray])
|
|
71
|
+
_decode = wrap_functions(
|
|
72
|
+
_report_lib, "rc_report_decode", _RcReportMeas,
|
|
73
|
+
[ctypes.c_size_t, _UINT8_P, ctypes.c_size_t, _UINT8_P])
|
|
74
|
+
_free_meas = wrap_functions(_report_lib, "rc_report_free_meas", None, [ctypes.POINTER(_RcReportMeas)])
|
|
75
|
+
_LIB_ERR: Optional[str] = None
|
|
76
|
+
except Exception as e: # rc_report_* not present in librc_1_03.so (old control-only build)
|
|
77
|
+
_report_lib = None
|
|
78
|
+
_LIB_ERR = str(e)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _require_lib():
|
|
82
|
+
if _report_lib is None:
|
|
83
|
+
raise RuntimeError(
|
|
84
|
+
"RC REPORT helpers not available in librc_1_03.so ({}). Rebuild the "
|
|
85
|
+
"RC SM (flexric-sm/rc_sm) with rc_report_api and redeploy "
|
|
86
|
+
"librc_1_03.so.".format(_LIB_ERR))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _to_bytes(x) -> bytes:
|
|
90
|
+
"""Normalise an indication buffer to Python bytes. The report base
|
|
91
|
+
(`xAppReportService._handle_indication`) hands decode_message a ctypes
|
|
92
|
+
``c_uint8 * N`` array (from utility.get_c_byte_array_from_py_byte_string), but
|
|
93
|
+
a ByteArray struct is also accepted for symmetry with the encoders."""
|
|
94
|
+
if isinstance(x, ByteArray):
|
|
95
|
+
return x.to_bytes()
|
|
96
|
+
if isinstance(x, (bytes, bytearray)):
|
|
97
|
+
return bytes(x)
|
|
98
|
+
return bytes(x) # ctypes c_uint8 array -> its payload bytes
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _own_byte_array(c_ba: ByteArray) -> ByteArray:
|
|
102
|
+
"""Copy a C-owned byte_array_t into a Python-owned ByteArray, then free the
|
|
103
|
+
C buffer. The returned ByteArray keeps its own backing store alive."""
|
|
104
|
+
data = c_ba.to_bytes()
|
|
105
|
+
_free_ba(c_ba)
|
|
106
|
+
out = ByteArray()
|
|
107
|
+
out.from_hex(data.hex())
|
|
108
|
+
return out
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
# --- (1) subscription encode ------------------------------------------------
|
|
112
|
+
|
|
113
|
+
def encode_report_subscription(ran_period_ms: int = 1000) -> Tuple[ByteArray, ByteArray]:
|
|
114
|
+
"""Return ``(event_trigger_ba, action_definition_ba)`` for REPORT Style 1
|
|
115
|
+
"Message Copy" of the UL-DCCH MeasurementReport. ``ran_period_ms`` is accepted
|
|
116
|
+
for interface symmetry but the trigger is message-driven, not periodic."""
|
|
117
|
+
_require_lib()
|
|
118
|
+
et = _enc_event_trigger()
|
|
119
|
+
ad = _enc_action_def()
|
|
120
|
+
if not et.len or not ad.len:
|
|
121
|
+
# free whatever was allocated to avoid leaks on partial failure
|
|
122
|
+
if et.len:
|
|
123
|
+
_free_ba(et)
|
|
124
|
+
if ad.len:
|
|
125
|
+
_free_ba(ad)
|
|
126
|
+
raise RuntimeError("E2SM-RC REPORT subscription encode returned empty bytes")
|
|
127
|
+
return _own_byte_array(et), _own_byte_array(ad)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# --- (2)+(3) indication + NR-RRC MeasurementReport decode ------------------
|
|
131
|
+
|
|
132
|
+
class DecodedMeasReport:
|
|
133
|
+
"""Decoded UE MeasurementReport handed to the data ingestor callback.
|
|
134
|
+
|
|
135
|
+
``ue_id`` is None: RC REPORT Style 1 indication header (format 1) carries only
|
|
136
|
+
the event-trigger id, not a UE identity, so the ingestor tags these with the
|
|
137
|
+
cell-level sentinel. ``get_neighbor_measurements`` yields every measured cell
|
|
138
|
+
(serving + neighbour) that reported RSRP, keyed by PCI, which is what the
|
|
139
|
+
decision engine matches a candidate target gNB against.
|
|
140
|
+
"""
|
|
141
|
+
|
|
142
|
+
def __init__(self, ue_id: Optional[int],
|
|
143
|
+
cells: List[Tuple[int, float, Optional[float], Optional[float]]],
|
|
144
|
+
is_meas_report: bool, ev_trigger_id: int):
|
|
145
|
+
self.ue_id = ue_id
|
|
146
|
+
self._cells = cells
|
|
147
|
+
self.is_meas_report = is_meas_report
|
|
148
|
+
self.ev_trigger_id = ev_trigger_id
|
|
149
|
+
|
|
150
|
+
def get_neighbor_measurements(self) -> List[Tuple[int, float, Optional[float], Optional[float], bool]]:
|
|
151
|
+
"""List of ``(pci, rsrp_dbm, rsrq_db, sinr_db, is_neighbour)`` per measured
|
|
152
|
+
cell. ``is_neighbour`` is False for the serving cell(s)
|
|
153
|
+
(measResultServingMOList) and True for neighbour cells
|
|
154
|
+
(measResultNeighCells) -- i.e. the HO target candidates. rsrq/sinr are None
|
|
155
|
+
when the UE did not report them."""
|
|
156
|
+
return self._cells
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def decode_meas_report(ind_hdr, ind_msg) -> DecodedMeasReport:
|
|
160
|
+
"""Decode an E2SM-RC indication (header+message) carrying a copied RRC message
|
|
161
|
+
and, if it is a MeasurementReport, extract the per-cell measurements.
|
|
162
|
+
|
|
163
|
+
``ind_hdr``/``ind_msg`` are whatever the report base passes to decode_message
|
|
164
|
+
(ctypes c_uint8 arrays), or ByteArray -- both handled by _to_bytes."""
|
|
165
|
+
_require_lib()
|
|
166
|
+
|
|
167
|
+
hbytes = _to_bytes(ind_hdr)
|
|
168
|
+
mbytes = _to_bytes(ind_msg)
|
|
169
|
+
# flexric's rc_dec_ind_{hdr,msg}_asn assert on NULL/empty input (they would
|
|
170
|
+
# abort the whole xApp process), so never hand them an empty buffer.
|
|
171
|
+
if not hbytes or not mbytes:
|
|
172
|
+
return DecodedMeasReport(None, [], False, -1)
|
|
173
|
+
|
|
174
|
+
hbuf = (ctypes.c_uint8 * len(hbytes)).from_buffer_copy(hbytes)
|
|
175
|
+
mbuf = (ctypes.c_uint8 * len(mbytes)).from_buffer_copy(mbytes)
|
|
176
|
+
|
|
177
|
+
res = _decode(len(hbytes), ctypes.cast(hbuf, _UINT8_P),
|
|
178
|
+
len(mbytes), ctypes.cast(mbuf, _UINT8_P))
|
|
179
|
+
|
|
180
|
+
cells: List[Tuple[int, float, Optional[float], Optional[float]]] = []
|
|
181
|
+
try:
|
|
182
|
+
for i in range(res.len):
|
|
183
|
+
c = res.cells[i]
|
|
184
|
+
if c.pci < 0 or not c.has_rsrp:
|
|
185
|
+
continue # rsrp is the ranking key; skip cells without a PCI/RSRP
|
|
186
|
+
rsrq = float(c.rsrq) if c.has_rsrq else None
|
|
187
|
+
sinr = float(c.sinr) if c.has_sinr else None
|
|
188
|
+
cells.append((int(c.pci), float(c.rsrp), rsrq, sinr, bool(c.is_neighbour)))
|
|
189
|
+
is_meas = bool(res.is_meas_report)
|
|
190
|
+
ev_id = int(res.ev_trigger_id)
|
|
191
|
+
finally:
|
|
192
|
+
_free_meas(ctypes.byref(res))
|
|
193
|
+
|
|
194
|
+
return DecodedMeasReport(None, cells, is_meas, ev_id)
|
xdevsm-0.1.0/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.1.0
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlHdr.py
RENAMED
|
File without changes
|
{xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlMsg.py
RENAMED
|
File without changes
|
{xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlOut.py
RENAMED
|
File without changes
|
{xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlReq.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/report/DAppFunctionDef.py
RENAMED
|
File without changes
|
{xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/report/DAppIndicationHdr.py
RENAMED
|
File without changes
|
{xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/dapp/report/DAppIndicationMsg.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xdevsm-0.1.0 → xdevsm-0.1.1}/src/xdevsm/sm_framework/py_oran/kpm/function_definition_builder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|