xdevsm 0.1.0__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.
Files changed (78) hide show
  1. xdevsm-0.1.0/.gitignore +11 -0
  2. xdevsm-0.1.0/LICENSE +201 -0
  3. xdevsm-0.1.0/PKG-INFO +408 -0
  4. xdevsm-0.1.0/README.md +381 -0
  5. xdevsm-0.1.0/VERSION +1 -0
  6. xdevsm-0.1.0/pyproject.toml +74 -0
  7. xdevsm-0.1.0/src/xdevsm/__init__.py +50 -0
  8. xdevsm-0.1.0/src/xdevsm/decorators/__init__.py +0 -0
  9. xdevsm-0.1.0/src/xdevsm/decorators/base.py +28 -0
  10. xdevsm-0.1.0/src/xdevsm/decorators/ccc/__init__.py +0 -0
  11. xdevsm-0.1.0/src/xdevsm/decorators/ccc/ccc_frame.py +190 -0
  12. xdevsm-0.1.0/src/xdevsm/decorators/control.py +265 -0
  13. xdevsm-0.1.0/src/xdevsm/decorators/dApp/__init__.py +0 -0
  14. xdevsm-0.1.0/src/xdevsm/decorators/dApp/control/__init__.py +0 -0
  15. xdevsm-0.1.0/src/xdevsm/decorators/dApp/control/dapp_prb_mask_control.py +66 -0
  16. xdevsm-0.1.0/src/xdevsm/decorators/dApp/report/__init__.py +0 -0
  17. xdevsm-0.1.0/src/xdevsm/decorators/dApp/report/dapp_report.py +162 -0
  18. xdevsm-0.1.0/src/xdevsm/decorators/kpm/__init__.py +0 -0
  19. xdevsm-0.1.0/src/xdevsm/decorators/kpm/kpm_frame.py +171 -0
  20. xdevsm-0.1.0/src/xdevsm/decorators/no_op_dec.py +23 -0
  21. xdevsm-0.1.0/src/xdevsm/decorators/rc/__init__.py +0 -0
  22. xdevsm-0.1.0/src/xdevsm/decorators/rc/rc_connected_mode_mobility.py +58 -0
  23. xdevsm-0.1.0/src/xdevsm/decorators/rc/rc_radio_bearer_control.py +74 -0
  24. xdevsm-0.1.0/src/xdevsm/decorators/rc/rc_radio_resource_alloc_control.py +104 -0
  25. xdevsm-0.1.0/src/xdevsm/decorators/report.py +272 -0
  26. xdevsm-0.1.0/src/xdevsm/handlers/I_xDevSM_xapp.py +37 -0
  27. xdevsm-0.1.0/src/xdevsm/handlers/__init__.py +0 -0
  28. xdevsm-0.1.0/src/xdevsm/handlers/config.py +36 -0
  29. xdevsm-0.1.0/src/xdevsm/handlers/xDevSM_rmr_xapp.py +327 -0
  30. xdevsm-0.1.0/src/xdevsm/sm_framework/README.md +7 -0
  31. xdevsm-0.1.0/src/xdevsm/sm_framework/__init__.py +0 -0
  32. xdevsm-0.1.0/src/xdevsm/sm_framework/lib/__init__.py +0 -0
  33. xdevsm-0.1.0/src/xdevsm/sm_framework/lib/libdapp_sm.so +0 -0
  34. xdevsm-0.1.0/src/xdevsm/sm_framework/lib/libkpm_sm.so +0 -0
  35. xdevsm-0.1.0/src/xdevsm/sm_framework/lib/libkpm_sm_2_01.so +0 -0
  36. xdevsm-0.1.0/src/xdevsm/sm_framework/lib/library_wrapper.py +55 -0
  37. xdevsm-0.1.0/src/xdevsm/sm_framework/lib/librc_1_03.so +0 -0
  38. xdevsm-0.1.0/src/xdevsm/sm_framework/lib/libsm_framework.so +0 -0
  39. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/ByteArray.py +33 -0
  40. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/__init__.py +0 -0
  41. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/ccc/__init__.py +0 -0
  42. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/ccc/ccc_decoder.py +66 -0
  43. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/ccc/ccc_encoder.py +84 -0
  44. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/ccc/constants.py +35 -0
  45. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/__init__.py +0 -0
  46. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlHdr.py +47 -0
  47. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlMsg.py +50 -0
  48. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlOut.py +42 -0
  49. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/control/DAppControlReq.py +47 -0
  50. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/control/__init__.py +0 -0
  51. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/e3/DAppE3CtrlPayload.py +68 -0
  52. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/e3/DAppE3IndPayload.py +66 -0
  53. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/e3/__init__.py +0 -0
  54. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/enums.py +35 -0
  55. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/report/DAppActionDef.py +48 -0
  56. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/report/DAppEvTrigger.py +37 -0
  57. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/report/DAppFunctionDef.py +156 -0
  58. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/report/DAppIndicationHdr.py +56 -0
  59. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/report/DAppIndicationMsg.py +79 -0
  60. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/dapp/report/__init__.py +0 -0
  61. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/kpm/KpmFunctionDef.py +64 -0
  62. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/kpm/KpmIndicationHdr.py +52 -0
  63. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/kpm/KpmIndicationMsg.py +586 -0
  64. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/kpm/MeasData.py +119 -0
  65. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/kpm/__init__.py +0 -0
  66. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/kpm/enums.py +110 -0
  67. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/kpm/function_definition_builder.py +118 -0
  68. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/rc/RCControlHdr.py +188 -0
  69. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/rc/RCControlMsg.py +103 -0
  70. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/rc/RCControlReq.py +737 -0
  71. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/rc/RCFunctionDef.py +328 -0
  72. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/rc/__init__.py +0 -0
  73. xdevsm-0.1.0/src/xdevsm/sm_framework/py_oran/rc/enums.py +93 -0
  74. xdevsm-0.1.0/src/xdevsm/utils/__init__.py +0 -0
  75. xdevsm-0.1.0/src/xdevsm/utils/constants.py +20 -0
  76. xdevsm-0.1.0/src/xdevsm/utils/lat_profile.py +47 -0
  77. xdevsm-0.1.0/src/xdevsm/utils/utility.py +113 -0
  78. xdevsm-0.1.0/src/xdevsm/utils/xapp_sub.py +165 -0
@@ -0,0 +1,11 @@
1
+ .venv
2
+ .vscode
3
+ .idea
4
+ __pycache__
5
+ *.py[cod]
6
+
7
+ # Packaging / build artifacts
8
+ build/
9
+ dist/
10
+ *.egg-info/
11
+ .pytest_cache/
xdevsm-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
xdevsm-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,408 @@
1
+ Metadata-Version: 2.5
2
+ Name: xdevsm
3
+ Version: 0.1.0
4
+ Summary: An SDK framework for building O-RAN xApps over E2 Service Models (KPM, RC, CCC).
5
+ Project-URL: Homepage, https://openrangym.com/tutorials/xdevsm-tutorial
6
+ Project-URL: Package, https://pypi.org/project/xdevsm/
7
+ Project-URL: Source, https://github.com/wineslab/xDevSM
8
+ Project-URL: Bug Tracker, https://github.com/wineslab/xDevSM/issues
9
+ Author: Andrea Feraudo, Simone Maxenti, Paolo Bellavista, Michele Polese, Tommaso Melodia
10
+ Author-email: Andrea Lacava <thecave003@gmail.com>
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ Keywords: 5G,CCC,E2SM,KPM,O-RAN,RC,cellular,near-RT RIC,networks,xApp
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: Implementation :: CPython
19
+ Requires-Python: <3.12,>=3.11
20
+ Requires-Dist: mdclogpy
21
+ Requires-Dist: numpy
22
+ Requires-Dist: requests
23
+ Requires-Dist: ricxappframe
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest; extra == 'dev'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # xDevSM
29
+
30
+ [![PyPI](https://img.shields.io/pypi/v/xdevsm.svg)](https://pypi.org/project/xdevsm/)
31
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
32
+
33
+ ## Overview
34
+
35
+ The xDevSM API framework provides xApp developers with a SDK exposing simple APIs to streamline the procedures defined by different E2SM protocols, facilitating interactions between the xApp, the near-RT RIC, and the E2 termination on the RAN.
36
+ It wraps and orchestrates message encoding/decoding, RMR-based communication, and SM-specific behavior. Internally, it delegates encoding and decoding tasks to the `sm_framework`, which defines the core logic for each Service Model (KPM, RC, and CCC).
37
+
38
+ xDevSM is built on top of [ricxappframe](https://pypi.org/project/ricxappframe/) python framework.
39
+
40
+ The architecture separates three main layers:
41
+
42
+ 1. **xApp API Layer** — developer-facing classes (`BasexDevSMXapp`, `xDevSMRMRXapp`, wrappers).
43
+ 2. **Service Model Wrappers** — expose KPM, RC, and CCC functionalities.
44
+ 3. **sm_framework** — performs actual encoding/decoding (internal).
45
+
46
+ > ⚠️ The xDevSM framework is designed to operate exclusively with the O-RAN Software Community (OSC) Near-RT RIC. </br> ℹ️ The current version has been tested with the OSC RIC Release J.
47
+
48
+ ### Supported Service Model Actions
49
+ | **Service Model** | **Action Type** | **Supported Actions** |
50
+ |-----------------------|--------------------|---------------------------|
51
+ | **KPM (Key Performance Measurement)** | Measurement Actions | • Common Condition-based Measurement, UE-level Measurement |
52
+ | **RC (RAN Control)** | Control Actions | • QoS Flow Mapping Configuration<br>• Slice-level PRB Quota Action (only monolithic gNBs)<br>• Connected Mode Mobility Control |
53
+ | **CCC (Cell Configuration and Control)** | Report Actions | • Cell-level RAN Configuration Reporting (REPORT Style 2, periodic event trigger) — e.g. `O-NRCellDU` attributes |
54
+ ---
55
+
56
+ ## Installation
57
+
58
+ xDevSM is distributed as the [`xdevsm`](https://pypi.org/project/xdevsm/) package on PyPI:
59
+
60
+ ```bash
61
+ pip install xdevsm
62
+ ```
63
+
64
+ > ℹ️ The package bundles the prebuilt `sm_framework` encoders (`.so`) as package data and is
65
+ > published as a source distribution, so a **linux-x86_64** environment and **Python 3.11**
66
+ > are required (matching the O-RAN SC Near-RT RIC deployment target). Python 3.12+ is not
67
+ > supported: `ricxappframe` depends on `ricsdl`, which pins `hiredis==2.0.0`, and that
68
+ > version cannot be built on 3.12 or later.
69
+ >
70
+ > No `LD_LIBRARY_PATH` setup is needed — the bundled encoders are loaded relative to the
71
+ > installed package. A **C compiler is required**, though: `hiredis==2.0.0` ships no wheel for
72
+ > 3.11, so pip builds it from source. Slim base images therefore need `gcc` installed (the
73
+ > full `python:3.11-bullseye` image already has it).
74
+
75
+ For local development (tests, editable install):
76
+
77
+ ```bash
78
+ git clone https://github.com/wineslab/xDevSM.git
79
+ cd xDevSM
80
+ pip install -e ".[dev]"
81
+ pytest tests/ -v
82
+ ```
83
+
84
+ ### Importing
85
+
86
+ Everything lives under the top-level `xdevsm` package. The developer-facing classes are also
87
+ re-exported from the package root for convenience:
88
+
89
+ ```python
90
+ # Convenience (recommended)
91
+ from xdevsm import xDevSMRMRXapp, XappKpmFrame, XappCccFrame, RadioBearerControl
92
+
93
+ # Or import from the fully-qualified submodules
94
+ from xdevsm.handlers.xDevSM_rmr_xapp import xDevSMRMRXapp
95
+ from xdevsm.decorators.kpm.kpm_frame import XappKpmFrame
96
+ from xdevsm.decorators.ccc.ccc_frame import XappCccFrame
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Class Hierarchy
102
+
103
+ ```
104
+
105
+ BasexDevSMXapp
106
+ └── xDevSMRMRXapp
107
+ └── BaseXDevSMWrapper
108
+ ├── xAppReportService
109
+ │ ├── XappKpmFrame
110
+ │ └── XappCccFrame
111
+ └── xAppControlService
112
+ ├── RadioBearerControl
113
+ ├── RadioResourceAllocationControl
114
+ └── ConnectedModeMobilityControl
115
+ ```
116
+
117
+ > ℹ️ A detailed diagram is available [here](xdevsmclassdiagram.pdf).
118
+
119
+ ---
120
+
121
+ ## 1. BasexDevSMXapp
122
+ Defines the core xApp interface that integrates xDevSM functionality with RMR. Provides the fundamental methods used by all xDevSM-based xApps.
123
+
124
+ Base class implementing the RMR communication layer. It provides generic `send()`, `receive()`, and `terminate()` methods for message passing between xApps and the Near-RT RIC.
125
+
126
+ | Method | Description |
127
+ | -------------------------------- | --------------------------------------------------------------------------------- |
128
+ | `handle(xapp, summary, sbuf)` | Method called by the `ricxappframe`. Entry point for processing received messages (`Indication` and `RIC CONTROL ` Messages`). Should be overridden by subclasses. |
129
+ | `send(self, *args, **kwargs)` | Sends a message via RMR after encoding. Input depends on the underlying E2SM. |
130
+ | `terminate()` | Gracefully stops the xApp. |
131
+ | `get_ran_function_description(json_ran_info)` | Uses the `sm_framework` to decode the RAN function description depending on the SM. |
132
+
133
+ ---
134
+
135
+ ## 3. xDevSMRMRXapp
136
+
137
+ **Purpose:**
138
+ Extends `BasexDevSMXapp` to provide additional functionality specific to the xDevSM architecture.
139
+
140
+ **Key Methods:**
141
+
142
+ | Method | Description |
143
+ | ------------------------------------- | ------------------------------------------------------------------------------ |
144
+ | `register_handler(handler)` | Registers callback handlers. |
145
+ | `register_shutdown(handler)` | Registers a shutdown handler for cleanup tasks. |
146
+ | `get_ran_info()` | Returns E2 node-related encoded information. |
147
+
148
+ This class is used as the base class for wrapper components.
149
+
150
+ ---
151
+
152
+ ## 4. BaseXDevSMWrapper
153
+
154
+ **Purpose:**
155
+ Provides a composition interface that connects Service Model–specific APIs (KPM, RC, etc.) with an instance of `xDevSMRMRXapp`. This allows to decorate the xApp with Service Model realted behavior.
156
+
157
+ **Attributes:**
158
+
159
+ * `xapp_handler` — instance of `BasexDevSMXapp`.
160
+
161
+ **Usage:**
162
+ This class is not used directly but extended by RIC service bases (`xAppReportService`, `xAppControlService`) and then by Service Model–specific decorators (e.g. `XappKpmFrame`, `RadioResourceAllocationControl`) that expose the actual APIs.
163
+
164
+ ---
165
+
166
+ ## 5. XappKpmFrame
167
+
168
+ **Purpose:**
169
+ Implements the external API for the **Key Performance Measurement (KPM)** Service Model.
170
+
171
+ Internally, it uses encoding and decoding classes from the `sm_framework` to handle message serialization before E2AP wrapping and RMR transmission.
172
+
173
+ **Common Operations:**
174
+
175
+ * Encode KPM Subscription Requests.
176
+ * Decode and Parse received KPM Indications.
177
+
178
+ **Example:**
179
+
180
+ ```python
181
+ xapp_gen = xDevSMRMRXapp(...)
182
+ kpm_api = XappKpmFrame(xapp_handler)
183
+ kpm_api.subscribe(gnb=self.selected_gnb,
184
+ ev_trigger=ev_trigger_tuple,
185
+ func_def=func_def_sub_dict,
186
+ ran_period_ms=1000,
187
+ sst=self.sst, sd=
188
+ self.sd)
189
+ ```
190
+
191
+
192
+ ---
193
+
194
+ ## 6. XappCccFrame
195
+
196
+ **Purpose:**
197
+ Implements the external API for the **Cell Configuration and Control (CCC)** Service Model (`ORAN-E2SM-CCC`, RAN Function OID `1.3.6.1.4.1.53148.1.1.2.4`, SM ID `149`). Like `XappKpmFrame`, it is a **REPORT**-type decorator and extends `xAppReportService`, mirroring the KPM lifecycle (subscribe → indication decode → callback).
198
+
199
+ Unlike KPM and RC, E2SM-CCC uses a **JSON** wire encoding rather than ASN.1, so the CCC encoders/decoders in `sm_framework/py_oran/ccc/` are pure-Python and never cross into the native `.so` libraries.
200
+
201
+ **Common Operations:**
202
+
203
+ * Encode CCC Subscription Requests — periodic Event Trigger (Format 3) + cell-level Action Definition (Format 2, REPORT Style 2).
204
+ * Decode and parse received CCC Indications via `CccIndicationHeader` / `CccIndicationMessage`.
205
+
206
+ **Supported REPORT style:**
207
+
208
+ | Style | Description |
209
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------- |
210
+ | REPORT Style 2 — Cell Level | Reports RAN Configuration Structures (e.g. `O-NRCellDU`) and a selected set of attributes (`arfcnDL`, `bSChannelBwDL`, `bWPList`, …) per cell. |
211
+
212
+ **Example:**
213
+
214
+ ```python
215
+ xapp_gen = xDevSMRMRXapp("0.0.0.0", route_file=args.route_file)
216
+
217
+ ccc_xapp = XappCccFrame(xapp_gen,
218
+ logger=xapp_gen.logger,
219
+ server=xapp_gen.server,
220
+ xapp_name=xapp_gen.get_xapp_name(),
221
+ rmr_port=xapp_gen.rmr_port,
222
+ http_port=xapp_gen.http_port,
223
+ pltnamespace=xapp_gen.get_pltnamespace(),
224
+ app_namespace=xapp_gen.get_app_namespace())
225
+
226
+ # Wire callbacks
227
+ xapp_gen.register_handler(ccc_xapp.handle)
228
+ ccc_xapp.register_ind_msg_callback(handler=indication_callback) # (hdr, msg, meid, sub_id)
229
+ ccc_xapp.register_sub_fail_callback(handler=sub_failed_callback)
230
+
231
+ # Subscribe to a periodic cell-level REPORT on O-NRCellDU
232
+ ccc_xapp.subscribe(gnb=selected_gnb,
233
+ ran_period_ms=1000,
234
+ ran_cfg_structure_name="O-NRCellDU",
235
+ attributes=["arfcnDL", "bSChannelBwDL", "bWPList"])
236
+
237
+ # or the one-call helper for those three target attributes:
238
+ ccc_xapp.subscribe_arfcn_bw_bwps(gnb=selected_gnb, ran_period_ms=1000)
239
+ ```
240
+
241
+ > ℹ️ The indication callback signature is `handler(ind_hdr, ind_msg, meid, sub_id)`. Iterate the reported cells/structures with `ind_msg.cells()` / `ind_msg.iter_structures()`.
242
+
243
+ ---
244
+ ## 7. xAppReportService
245
+
246
+ **Purpose:**
247
+ Provides the base class for **Report-type** Service Models. Handles subscription management, indication message routing, and decoding.
248
+
249
+ **Common Responsibilities:**
250
+
251
+ * Build and send E2 subscription requests.
252
+ * Route incoming indication messages to registered callbacks.
253
+ * Interface with `sm_framework` for decoding RAN function descriptions.
254
+
255
+ **Specializations:**
256
+
257
+ | Subclass | Description |
258
+ | --------------- | --------------------------------------------------- |
259
+ | `XappKpmFrame` | Implements KPM-specific subscription and indication handling. |
260
+ | `XappCccFrame` | Implements CCC-specific (Cell Configuration and Control) subscription and indication handling over a JSON encoding. |
261
+
262
+ ---
263
+
264
+ ## 8. xAppControlService
265
+
266
+ **Purpose:**
267
+ Provides the base class for the **Radio Control (RC)** Service Model. Defines shared functionality across different RC control operations.
268
+
269
+ **Common Responsibilities:**
270
+
271
+ * Initialize and validate RC messages.
272
+ * Interface with `sm_framework` for encoding and decoding.
273
+ * Offer helper methods for constructing Control Requests.
274
+ * Handle RIC Control Acknowledge and Failure messages.
275
+
276
+ **Specializations:**
277
+
278
+ | Subclass - Style | Description | Control Action Id Support |
279
+ | ----------------------------------- | --------------------------------------------------------- | -------------------------------------- |
280
+ | `RadioBearerControl` - 1 | Handles bearer-level control (QoS, bearer setup/release). | (2) QoS flow mapping configuration |
281
+ | `RadioResourceAllocationControl` - 2| Manages resource allocation (e.g., PRB or scheduling). | (6) Slice-level PRB quota |
282
+ | `ConnectedModeMobilityControl` - 3 | Manages handover and mobility-related control procedures. | (1) Handover control |
283
+
284
+ Each subclass defines Service Model–specific operations and message structures, invoking the appropriate encoder/decoder from `sm_framework.rc`.
285
+
286
+ > ℹ️ Control parameters can be modified using getter and setter methods.
287
+
288
+ **Example: Radio Bearer Control Initialization**
289
+
290
+ ```python
291
+ xapp_gen = xDevSMRMRXapp("0.0.0.0", route_file=args.route_file)
292
+
293
+ rc_xapp = RadioBearerControl(xapp_gen,
294
+ logger=logger,
295
+ server=xapp_gen.server,
296
+ xapp_name=xapp_gen.get_xapp_name(),
297
+ rmr_port=xapp_gen.rmr_port,
298
+ http_port=xapp_gen.http_port,
299
+ mrc=xapp_gen._mrc,
300
+ pltnamespace=xapp_gen.get_pltnamespace(),
301
+ app_namespace=xapp_gen.get_app_namespace(),
302
+ # control parameters
303
+ drb_id=args.drb_id,
304
+ qos_flow_id=args.qos_flow_id,
305
+ qos_flow_mapping_indication=args.qos_flow_mapping_indication
306
+ )
307
+ ```
308
+
309
+ **Example: Radio Resource Allocation Control**
310
+ ```python
311
+ xapp_gen = xDevSMRMRXapp("0.0.0.0")
312
+ rc_xapp = RadioResourceAllocationControl(xapp_gen,
313
+ logger=logger,
314
+ server=xapp_gen.server,
315
+ xapp_name=xapp_gen.get_xapp_name(),
316
+ rmr_port=xapp_gen.rmr_port,
317
+ http_port=xapp_gen.http_port,
318
+ mrc=xapp_gen._mrc,
319
+ pltnamespace=xapp_gen.get_pltnamespace(),
320
+ app_namespace=xapp_gen.get_app_namespace(),
321
+ # control parameters
322
+ plmn_identity="00F110",
323
+ sst=1,
324
+ sd=1,
325
+ min_prb_policy_ratio=10,
326
+ max_prb_policy_ratio=70,
327
+ dedicated_prb_policy_ratio=5
328
+ )
329
+ ```
330
+
331
+ **Example: Connected Mode Mobility Control**
332
+ ```python
333
+ xapp_gen = xDevSMRMRXapp("0.0.0.0")
334
+ rc_xapp = ConnectedModeMobilityControl(xapp_gen,
335
+ logger=logger,
336
+ server=xapp_gen.server,
337
+ xapp_name=xapp_gen.get_xapp_name(),
338
+ rmr_port=xapp_gen.rmr_port,
339
+ http_port=xapp_gen.http_port,
340
+ mrc=xapp_gen._mrc,
341
+ pltnamespace=xapp_gen.get_pltnamespace(),
342
+ app_namespace=xapp_gen.get_app_namespace(),
343
+ # control parameters
344
+ plmn_identity="00F110",
345
+ nr_cell_id="00000000000000000000111000000001"
346
+ )
347
+ ```
348
+
349
+
350
+ ---
351
+
352
+ ## 9. Service Model Encoder/Decoder
353
+
354
+ The `sm_framework` provides the internal logic for encoding and decoding messages according to the KPM, RC, and CCC Service Models. The xDevSM decorators are organized by RIC service direction: `xAppReportService` and `xAppControlService` are the generic bases for report- and control-style services, and any service model (KPM, RC, CCC, ...) plugs in by extending the appropriate base — for example `XappKpmFrame` and `XappCccFrame` extend `xAppReportService`, and `RadioResourceAllocationControl` extends `xAppControlService`.
355
+
356
+ > ℹ️ KPM and RC serialize through ctypes bindings to the native `.so` libraries, whereas CCC (E2SM-CCC) uses a pure-Python **JSON** codec in `sm_framework/py_oran/ccc/`.
357
+
358
+ ```
359
+ [ xApp code ] → [ xDevSM API ] → [ sm_framework (encode/decode) ] → [ E2AP + RMR ]
360
+ ```
361
+
362
+ Developers using `xDevSM` do not directly call `sm_framework`; it is fully managed by the wrapper classes.
363
+
364
+ ---
365
+
366
+ ## 10. Example xApps
367
+
368
+ For end-to-end examples of KPM, RC, and CCC xApps built on top of this API, see:
369
+
370
+ **[xDevSM-xapps-examples](https://github.com/wineslab/xDevSM-xapps-examples/tree/code_refactoring)**
371
+
372
+ This repository contains working implementations that demonstrate:
373
+
374
+ * How to set-up an xApp based on xDevSM.
375
+ * Registration of handlers.
376
+ * Sending and receiving encoded Service Model messages.
377
+
378
+ The **CCC basic xApp** (`ccc_xapp.py`) is a minimal reference: it subscribes to a periodic O-NRCellDU REPORT (Style 2 / Event Trigger Format 3) and pretty-prints every incoming indication (cell identity, frequencies, SSB, BWP list, …).
379
+
380
+ ---
381
+
382
+ ## 11. Extending the API
383
+
384
+ To support a new Service Model (E2SM):
385
+
386
+ 1. Implement the encoder/decoder in `sm_framework/<new_sm>/`.
387
+ 2. Create a new wrapper subclass (e.g., `XappNewSMFrame`) extending `BaseXDevSMWrapper`.
388
+ 3. Implement SM-specific methods (e.g., `send_<msg>()`, `handle_<msg>()`).
389
+ 4. Register handlers for the new message types in your xApp.
390
+
391
+ ---
392
+
393
+ ## 12. Other Sources
394
+
395
+ A detailed step-by-step tutorial for setting up a deployment to begin working with xDevSM is available [here](https://openrangym.com/tutorials/xdevsm-tutorial).
396
+
397
+ ## How To Cite
398
+ If you use xDevSM, please reference the following paper:
399
+ > A.Feraudo, S. Maxenti, A. Lacava, P. Bellavista, M. Polese, and T. Melodia, <i>"xDevSM: Streamlining xApp Development With a Flexible Framework for O-RAN E2 Service Models,"
400
+ > </i> Proceedings of the 18th ACM Workshop on Wireless Network Testbeds, Experimental evaluation & Characterization (WiNTECH), November, 2024.
401
+
402
+ ## License
403
+ This project is licensed under Apache License Version 2.0 - see [License File](LICENSE) for more details.
404
+
405
+ ## Organizations
406
+ | <img src="https://github.com/wineslab.png?s=100" width="60" height="60"> | [**Wireless Networks and Embedded Systems Lab**](https://github.com/wineslab) |
407
+ | :--: | :--: |
408
+ | <img src="https://github.com/MMw-Unibo.png?s=100" width="60" height="60"> | [**Mobile Middleware Research Group**](https://github.com/MMw-Unibo) |