FlexRIC tutorial: xApp development
OPEN AIR INTERFACE
Mikel Irazabal
OSA Senior Software Engineer
31/01/23
0 Outline |1
1 General O-RAN Architecture
2 FlexRIC’s: General Aspects and Principles
3 O-RAN xApp Architecture
4 FlexRIC xApp design
5 FAQs
6 Live Coding
7 Q&A
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
1 Outline |2
1 General O-RAN Architecture
2 FlexRIC’s: General Aspects and Principles
3 O-RAN xApp Architecture
4 FlexRIC xApp design
5 FAQs
6 Live Coding
7 Q&A
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
1 O-RAN Architecture |3
Figure: O-RAN Architecture
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
2 Outline |4
1 General O-RAN Architecture
2 FlexRIC’s: General Aspects and Principles
3 O-RAN xApp Architecture
4 FlexRIC xApp design
5 FAQs
6 Live Coding
7 Q&A
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
2 General Aspects and Principles |5
▶ Principles
> Ultra-lean for low-latency or resource-restricted use cases i.e., follows
the zero-overhead principle
> Flexibility and forward compatibility towards novel use cases through
the utilization of static and dynamic polymorphism
> A RAT-agnostic and vendor neutral SD-RAN design (e.g., OAI )
> Service Models (SMs) are implemented as shared objects to reduce the
coupling
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
2 FlexRIC v0.1 |6
▶ E2AP protocol v1 (20/26 messages in ASN.1)
▶ MAC,RLC and PDCP Service Models to monitor
▶ nearRT-RIC and E2 Agent
▶ iApps for low-latency communication
▶ Approx. 10 K LOC
▶ FlexRIC paper https://bit.ly/3uOXuCV
Mikel Irazabal
Figure: FlexRIC v0.1
FlexRIC tutorial: xApp development OSA Senior Software Engineer
2 FlexRIC v0.2 |7
▶ FlexRIC has become Multi-X
> Multi-vendor i.e., OAI and srsRAN
> Multi-RAT i.e., 4G and 5G
> Multi-language i.e., C/C++ and Python
> Multi-agent
> Multi-xApp
▶ New protocol between the xApp and the RIC i.e., E42
▶ New SMs have been developed (Slice and Traffic Control)
▶ FlexRIC has grown from approx. 10K to 50K LOC.
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
3 Outline |8
1 General O-RAN Architecture
2 FlexRIC’s: General Aspects and Principles
3 O-RAN xApp Architecture
4 FlexRIC xApp design
5 FAQs
6 Live Coding
7 Q&A
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
3 Network API vs SDK approach |9
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
3 Network API vs SDK approach | 10
▶ Network API approach: Each relevant Near-RT RIC endpoint exposes
a network endpoint and specifies a particular data encoding protocol
and a network transport protocol that should be used to communicate
with it. A different network API may be specified for each Near-RT
RIC API reflecting a trade-off between different service requirements.
> An application layer protocol used to carry a set of messages which
normally contain multiple Information Elements (IEs);
> A data encoding protocol (ASN.1, Protobuf, JSON, etc.);
> A network transport protocol (SCTP, HTTPS, gRPC, etc.);
> Associated security and encryption methods.
▶ SDK approach: The Near-RT RIC vendor provides an SDK (software
development kit). This SDK is a software library which handles all
connection management and exposes a simple API for the xApp to
interact with the Near-RT RIC. The interface between the SDK library
embedded in the xApp and the Near-RT RIC Platform may be either
vendor proprietary or aligned to the specified Network API.
> Providing simple APIs to trigger commonly used functionality;
> Handling routine management tasks “under the hood”;
> Providing tools for debugging, building, testing applications.
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
3 O-RAN xApp Requirements I | 11
▶ xApp may enhance the RRM capabilities of Near-RT RIC;
▶ xApp may be associated with zero, one or more E2SMs;
▶ xApp shall use Near-RT RIC APIs to make use of the Information
Elements (IEs) of E2SMs that are associated with it;
▶ xApp that is associated with a given E2SM shall be able to interface
with any E2 Node that supports that E2SM without any intermediary
xApp;
▶ xApp shall be able to receive event-triggered information on RAN
information and time-varying network state.
▶ xApp shall provide collected logging, tracing and metrics information
to Near-RT RIC;
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
3 O-RAN xApp Requirements II | 12
▶ xApp shall provide a descriptor that includes the following basic
information of the xApp:
> Configuration: It includes a data dictionary for configuration data, i.e.,
meta data such as a YANG definition or a list of configuration
parameters and their semantics. It may also include an initial
configuration of xApp;
> Control: It includes the types of data that an xApp consumes and
generates, in order to perform control capabilities (e.g., xApp URL,
parameters, input/output type);
> Metrics: It includes a list of metrics (e.g., metric name, type, unit and
semantics) provided by the xApp.
▶ The xApp descriptor shall also provide the necessary data to enable
management and orchestration of the xApp, aligned with [4];
▶ xApps shall communicate with Near-RT RIC platform via Near-RT
RIC APIs;
▶ xApp shall register the Near-RT RIC APIs it produces;
▶ xApp shall be capable of discovering the Near-RT RIC APIs they
consume.
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
3 O-RAN Architecture xApp APIs | 13
Figure: Overview of Near-RT RIC APIs
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
3 O-RAN Architecture xApp APIs | 14
▶ A1 APIs allowing to access A1 related functionality;
▶ E2 APIs allowing to access E2 related functionality and associated
xApp Subscription Management and Conflict Mitigation functionality;
▶ O1 Management APIs allowing to access management related
functionality;
▶ SDL APIs allowing to access Shared Data Layer related functionality;
▶ Enablement APIs between xApps and API enablement functionality.
Figure: Overview of Near-RT RIC APIs
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
4 Outline | 15
1 General O-RAN Architecture
2 FlexRIC’s: General Aspects and Principles
3 O-RAN xApp Architecture
4 FlexRIC xApp design
5 FAQs
6 Live Coding
7 Q&A
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
4 FlexRIC SDK | 16
Figure: Overview of FlexRIC’s SDK
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
4 E42 Design | 17
▶ O-RAN has some limitations
> A protocol needed between the SDK and the nearRT-RIC
> Need for an E2 Node concept
> Not defined the semantics of on-boarding
▶ Therefore, we decided to enhance E2 with E42 with 5 new messages
i.e., E42 Setup Request, E42 Setup Response, E42 Subscription
Request, E42 Subscription Delete Request and E42 RIC Control
Request,
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
4 E42 init | 18
▶ E42 Setup Request: available RAN Functions of the SDK. No Global
ID info as E2 Setup Request
▶ E42 Setup Response: Connected E2 Nodes with accepted RAN
Functions and xApp ID
Figure: E42 Initial connection
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
4 E42 Subscription Request | 19
▶ report_sm_xapp_api: E2 Node ID, SM ID, interval, callback
▶ E42 Subscription Request: xApp ID, E2 Node ID E2 Subscription
Request
▶ sm_ans_xapp_t: Handle for the user. Needed to remove the
subscription request
▶ sm_cb_handler: Function where the results arrive in the xApp code.
The xApp, also writes per default the data into an SQLite DB
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
4 E42 Control | 20
▶ Report_sm_xapp_api: E2 Node ID, SM ID, callback interval, E42
Subscription Request: xApp ID, E2 Node ID E2
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
4 Main xApp SDK components | 21
▶ Message handler, message generator, thread safe queue, pending
events, plug-in, sync User Interface and active procedures
Figure: xApp SDK core
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
4 Recently found data race in E42 Control | 22
▶ The message came back from the E2 Agent, while it associated
pending event was not stored
Mikel Irazabal Figure: Diagram
FlexRIC tutorial: xApp development OSA Senior Software Engineer
4 xApp SDK design principles | 23
▶ Simplicity. KISS principle
▶ Multi-language i.e., C/C++, Python, golang, java ...
▶ Efficient
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
4 Simplicity | 24
▶ xApp API
> Function init and stop functions
> Function to get the E2 Nodes
> Function to subscribe and remove subscription
> Function to control
Figure: xApp API functions
▶ xApp queries: Since some more complex operation may be required by
the user, we decided to embedded a DB into the xApp, so that
queries can be made directly to a DB, rather than maintaining the
states in the code FlexRIC tutorial: xApp development
Mikel Irazabal OSA Senior Software Engineer
4 Multi-language and efficient | 25
▶ SWIG is an interface compiler that connects programs written in C
and C++ with scripting languages such as Perl, Python, Ruby, and
Tcl. (Java, JavaScript, Go, D, C sharp ...)
▶ The idea is that the SDK is written in efficient C and that according
to our needs, we use the SWIG compiler to generate code for other
languages
Figure: SWIG and the SDK
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
4 SWIG Python Interface Caveat | 26
▶ For callbacks from C to Python, the Global Lock Interpreter (GIL) is
needed.
▶ GIL is needed to avoid data races in python reference count memory
model.
▶ This makes Python code single threaded when been called from the
callback.
▶ Therefore, you probably don’t want to spend much time in the
callback
Figure: Python Global Lock Interpreter
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
5 Outline | 27
1 General O-RAN Architecture
2 FlexRIC’s: General Aspects and Principles
3 O-RAN xApp Architecture
4 FlexRIC xApp design
5 FAQs
6 Live Coding
7 Q&A
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
5 FAQs I | 28
▶ Why invent E42 instead of using the well tested gRPC?
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
5 Answer I | 29
▶ gRPC (gRPC Remote Procedure Calls) is a cross-platform open
source high performance Remote Procedure Call (RPC) framework
from 2002.
▶ It uses HTTP/2 and Protobuffers which have been (mostly)
overcomed by Flatbuffers.
▶ E42 uses a raw SCTP socket. The protocol is very similar to E2AP
with slight modifications
▶ Currently, it encodes/decodes using ASN.1 but other possibilities are
possible e.g., Flatbuffers
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
5 Answer I | 30
Figure: Latency of one xApp fetching data every 5 ms
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
5 FAQs II | 31
▶ Why not use the O-RAN OSC developed E2AP? Why you developed a
new E2AP version from scratch? Was it a waste of time?
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
5 Answer II | 32
▶ ONOS, as well as O-RAN code was probably developed under time
constraints sacrificing quality
Figure: Code for Subscription Request from ONOS OAI repository fetched on the
27/01/203
Figure: E2AP specification
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
5 Answer II | 33
▶ FlexRIC is tested with a code coverage, a profiler, TSan and ASan.
Figure: Code coverage of 20/26 E2AP functions on the 27/01/203
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
5 FAQs III | 34
▶ Why FlexRIC was not developed as a cloud native software?
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
5 Answer III | 35
▶ Definition: Cloud native computing is an approach in software
development that utilizes cloud computing to "build and run scalable
applications in modern, dynamic environments such as public, private,
and hybrid clouds"
▶ Zero overhead principle i.e., you don’t pay for what you don’t use i.e.,
no containers per default
▶ FlexRIC is easily deployable i.e., we do not use any 3rd party software
▶ FlexRIC can easily be decomposed (low-coupling, e.g., E42)
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
5 FlexRIC SDK | 36
Figure: Comparison between OSC, ONOS and FlexRIC
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
5 FlexRIC SDK | 37
Figure: Comparison between OSC, ONOS and FlexRIC
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
6 Outline | 38
1 General O-RAN Architecture
2 FlexRIC’s: General Aspects and Principles
3 O-RAN xApp Architecture
4 FlexRIC xApp design
5 FAQs
6 Live Coding
7 Q&A
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
6 Live Coding | 39
▶ Live coding!
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
7 Outline | 40
1 General O-RAN Architecture
2 FlexRIC’s: General Aspects and Principles
3 O-RAN xApp Architecture
4 FlexRIC xApp design
5 FAQs
6 Live Coding
7 Q&A
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
7 Q&A | 41
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
7 FlexRIC Future | 42
▶ Your feedback is needed!
▶ https://forms.gle/gFq1ycknjDw3qHRo8
▶ https://openairinterface.org/mosaic5g/
Mikel Irazabal FlexRIC tutorial: xApp development OSA Senior Software Engineer
Thank you!