Repository navigation
Conversation
Thecave3
force-pushed
the
e2sm-dapp-python-xapp
branch
2 times, most recently
from
October 15, 2026 19:53
d5b9e67 to
7081ba5
Compare
Thecave3
force-pushed
the
e2sm-dapp-python-xapp
branch
from
November 2, 2026 23:26
7081ba5 to
0516699
Compare
eq_ric_service_update() compared the entries of the modified list with
if (eq_ran_function(&m0->modified[i], &m1->modified[i]))
return false;
so it reported two RIC Service Updates as different precisely when their
modified lists matched, and as equal when they did not. The added and
deleted lists next to it both test for == false; only this one is missing
it. Present identically in v1_01, v2_03 and v3_01.
It has gone unnoticed because the only caller is the encode/decode round
trip test, and that test is not run: the RIC Service Update codec asserted
"Untested code", so the test was commented out of main(). The next commit
implements the codec and enables the test, which is how this surfaced.
Co-authored-by: Andrea Lacava <thecave003@gmail.com>
Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Lacava <thecave003@gmail.com>
Both e2ap_enc_service_update_asn_pdu() and e2ap_dec_service_update()
(and their Acknowledge counterparts) opened with
assert(0 != 0 && "Untested code");
so the procedure could not be exercised at all. Beneath the assert the
code did not match the ASN.1:
- The mandatory TransactionID IE was never encoded, although the
decoder read it from index 0 and E2AP marks it mandatory.
- All three RAN-function lists were encoded unconditionally, so an
update carrying only one of them still emitted two empty
RANfunctions-Lists, violating SIZE(1..maxofRANfunctionID).
- The decoder read the lists positionally, at fixed indices 1..3.
Since every list is optional, any update that omitted one read the
wrong IE, or an IE that was not there.
- The deleted list built RANfunction-ItemIEs and appended them to
ran_mod's list rather than ran_del's, using RANfunction-Item where
the ASN.1 asks for RANfunctionID-Item.
- RANfunctionsAdded and RANfunctionsModified are distinct CHOICE
members of the same generated type (RANfunctions_List and
RANfunctions_List_1). The encoder had them the other way round from
the decoder.
- In the Acknowledge, the accepted and rejected items were tagged
ProtocolIE_ID_id_RANfunction_Item instead of
ProtocolIE_ID_id_RANfunctionID_Item, and criticality was ignore
where the ASN.1 says reject.
The decoder now reads the TransactionID at index 0 and dispatches the
remaining IEs by id rather than by position, which is what makes the
optional lists work in any combination.
test_service_update() and test_service_update_ack() already existed but
were commented out of main(). They are enabled, given the transaction id
to round trip, and the update test now fills all three lists at once --
filling only one, as before, would not have caught the added/modified
member mix-up. test_service_update_empty() covers the other boundary: an
update carrying nothing but the mandatory TransactionID.
Co-authored-by: Andrea Lacava <thecave003@gmail.com>
Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Lacava <thecave003@gmail.com>
mv_rd_e2_setup() ended in assert(0 != 0 && "Unknown types"), so an E2 SETUP answer whose service-model definition type is not one of the eight handled here takes the whole process down. That is reachable without anything being wrong: the plugin directory is scanned, not enumerated, so a service model left in libs_dir by another install is loaded and answers E2 SETUP with a type this build has no case for. It is also what a build configured with a different service-model set hits against an agent that has more. Leave dst zeroed instead. A service model is selected by RAN-function id when a subscription arrives, so one that is not modelled here is simply never chosen; there is no path that consumes the zeroed definition. Co-authored-by: Andrea Lacava <thecave003@gmail.com> Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Andrea Lacava <thecave003@gmail.com>
With the codec in place the procedure still had no implementation on
either side: e2ap_handle_service_update_ric() was
assert(0 != 0 && "Not Implemented"), the agent had no way to send an
update, and RIC_SERVICE_UPDATE reached neither the iApp dispatch table
nor the E2 node registry.
A service model whose RAN function definition depends on state the RAN
only learns after E2 SETUP has no other way to tell the RIC: E2 SETUP
happens once per connection. This closes that gap.
Agent side:
- e2_send_ric_service_update() encodes and sends the update.
- trigger_ric_service_update_api(ran_func_id) re-advertises one RAN
function with a monotonically increasing revision, which is what
makes the RIC replace the stored definition instead of rejecting a
duplicate. It takes the RAN function id rather than picking a
service model itself, so it stays independent of which service
models a deployment loads.
- e2ap_handle_service_update_ack_agent() reports the outcome and
names any RAN function the RIC rejected.
RIC side:
- e2ap_handle_service_update_ric() applies the added and deleted
lists to the E2 node's accepted set and answers with a RIC Service
Update Acknowledge listing what it took.
- The update carries no node id, so near_ric resolves it from the
socket the message arrived on, via the new reverse lookup
find_map_sad_e2_node(). That lookup returns false rather than
asserting when the socket has no node registered, and an update for
an unknown node is logged and dropped: this path is driven by
whatever arrives on the SCTP socket, so an assertion there would let
a stale or malformed update from any peer take the RIC down.
- The update is forwarded to the iApp, which applies it to the E2 node
registry through the new update_reg_e2_node(), so an xApp connecting
afterwards sees the current RAN function list.
RIC Service Update Failure is still unimplemented; a rejected update is
reported through the Acknowledge's rejected list.
Co-authored-by: Andrea Lacava <thecave003@gmail.com>
Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Lacava <thecave003@gmail.com>
A dApp is a control application that runs on the same host as the E2 node
and talks to it over a local interface, so it can act inside the
scheduling loop -- microseconds to a slot -- where an xApp behind E2 and a
RIC platform cannot. The two are complementary, but nothing today lets
them agree: both can act on the same resources with no view of what the
other has asked for.
E2SM-DAPP is the E2 service model that carries that exchange. It relays
two things between an xApp and the dApps attached to an E2 node:
- reports, dApp to xApp: report style 1 forwards a dApp's payload
verbatim; report style 2 reports which dApps are attached and which
E3 RAN functions each of them subscribed to, so an xApp can discover
them and see them come and go.
- controls, xApp to dApp: control style 1 addresses a payload to one
dApp and one of its RAN functions.
The service model does not interpret the payload it relays: the
indication message and the control message carry it as an octet string.
What the E2 node does with a control, and what a dApp puts in a report,
is agreed between them and is not E2's business. RAN function id 255,
OID 1.3.6.1.4.1.53148.1.1.255.3.
The E2SM-DAPP grammar (e2sm_dapp_v0_standard.asn) follows the shape of
the O-RAN service models already here: RAN function definition with
report and control style lists, per-format indication headers and
messages, control header, message and outcome. Both the indication
header and the control header carry an optional producer timestamp and an
optional correlation id, inside the APER extension markers, so a
deployment that wants to attribute latency across the xApp-dApp loop can
without either field being required.
Alongside it, e3/ decodes the relayed payload for the one payload format
we can describe: the spectrum-sharing schema a dApp uses to report which
PRBs it has blacklisted, and an xApp uses to ask for PRBs to be blocked.
The xApp half of the service model decodes it into a typed struct so the
example xApp can read it without a second copy of the schema, while the
E2 node side stays payload-agnostic. e3sm_spectrum.asn is a copy of a
schema shared with the E2 node and the dApp library, kept byte-identical
with both; a change to it has to move in all three places.
asn1c output is committed and listed explicitly, as it is for every other
service model here, so building needs no asn1c. The plain and flatbuffers
encoders are the usual unimplemented placeholders, matching rc_sm.
Co-authored-by: Andrea Lacava <thecave003@gmail.com>
Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Lacava <thecave003@gmail.com>
Wires the new service model into the tables every service model has to appear in: the agent read/write/answer types, the E2 node registry, the xApp RAN-function definition union, and the iApp listeners, which now recognise a DAPP indication rather than asserting on an unknown type. The relayed payload is opaque to the RIC, so the sqlite writer and the stdout listener say so rather than inventing a column layout for it. The control-outcome path needed one change beyond registration. E2AP makes the control outcome optional and msg_handler_xapp discarded it unconditionally, with a comment noting it could be used. sm_ric_t already declares on_control_out and sm_alloc_t declares free_ctrl_out_data; neither had a caller. The outcome is now handed to the service model that owns the RAN function when the acknowledgement carries one, which is how an xApp learns whether the dApp accepted its control. Co-authored-by: Andrea Lacava <thecave003@gmail.com> Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Andrea Lacava <thecave003@gmail.com>
Three tests, registered with ctest:
- Unit_test_DAPP drives an agent and a RIC through the service model:
subscription with each report style, indication in each format,
control and control outcome.
- Unit_test_enc_dec_DAPP round trips every information element through
the ASN.1 codec against randomly filled data, and covers the refusal
paths: a PRB index or count outside what the schema allows, a NULL
argument, a truncated buffer.
- fill_rnd_data_dapp supplies the random fillers, in the shape the kpm
and rc fillers already use.
examples/xApp/c/spectrum is a worked example rather than a smoke test: it
subscribes twice to the same E2 node, once per report style, so the two
arrive on separate RIC request ids and can be deleted independently; it
prints what each report carries; and it sends spectrum controls, which is
what exercises the xApp-to-dApp direction end to end.
Co-authored-by: Andrea Lacava <thecave003@gmail.com>
Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Lacava <thecave003@gmail.com>
Surfaces the service model through the SWIG xApp SDK, next to the MAC, RLC,
PDCP, GTP and SLICE bindings already there, and ports the C example to
Python. Both are behind XAPP_MULTILANGUAGE, which is off by default.
The binding hands an indication to Python as a flat struct rather than the
service model's nested one -- SWIG has no good way to express the tagged
unions -- and exposes the two report styles plus a spectrum control
helper. The correlation id is produced on this path too, so a Python xApp
is attributable the same way the C one is.
Two fixes were needed to make the binding loadable at all:
- e42_xapp_shared did not link the NR RRC ASN.1 definitions that the RC
service model's decoders reference, so importing the module failed with
an undefined asn_DEF_NR_UL_DCCH_Message. This is not new -- the SWIG
binding cannot be imported on dev either, for the same reason.
- time_now_us.h had no extern "C" guard, so the C++ wrapper looked for a
mangled time_now_ns().
Co-authored-by: Andrea Lacava <thecave003@gmail.com>
Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Lacava <thecave003@gmail.com>
Thecave3
force-pushed
the
e2sm-dapp-python-xapp
branch
from
November 27, 2026 13:59
0516699 to
e4f2910
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The E2SM-DAPP xApp in #12 is written in C. The SWIG xApp SDK already exposes MAC, RLC, PDCP, SLICE,
GTP and KPM to Python; this adds E2SM-DAPP to it, plus a Python port of that example so the
two can be read side by side.
Everything here is behind
XAPP_MULTILANGUAGE, which is off by default.Two fixes it needs, which are not about E2SM-DAPP
The SWIG binding cannot be imported on pristine
deveither, and both of these are inthe way:
e42_xapp_shareddoes not link the NR RRC ASN.1 definitions that the RC model's decodersreference, so
import xapp_sdkfails on an undefinedasn_DEF_NR_UL_DCCH_Message.time_now_us.hhas noextern "C"guard, so the C++ wrapper looks for a mangledtime_now_ns().Say the word if you would rather have those two as their own PR ahead of this one.
Verification
Built with
-DXAPP_MULTILANGUAGE=ON; the module imports and exports all 13 DAPP symbols.One environment note for whoever builds this next:
XAPP_MULTILANGUAGE=ONdoes notconfigure here without
-DPYTHON_LIBRARY=... -DPYTHON_INCLUDE_DIR=..., becauseswig/CMakeLists.txtuses the deprecatedFIND_PACKAGE(PythonLibs), which finds nothingon Python 3.12. That fails identically on pristine
dev; moving it toFindPython3wouldbe a sensible separate change.