Skip to content

async AAA invoke foundation + PFCP create transport (foundation for #22) - #48

Merged
next-nf merged 4 commits into
mainfrom
async-establishment-step3
Jul 27, 2026
Merged

async AAA invoke foundation + PFCP create transport (foundation for #22)#48
next-nf merged 4 commits into
mainfrom
async-establishment-step3

Conversation

@next-nf

@next-nf next-nf commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Foundation for #22. Two independent pieces:

Whole-pipeline async AAA invoke (redesign — see the resolved thread on smf_aaa_pcf). smf_aaa_*:invoke(#{pipeline_async => true}) runs the entire handler pipeline in a monitored worker (smf_aaa_session:spawn_request + run_pipeline_async) and returns one ReqId; the context awaits it and binds the fully-folded pipeline result — not the first step. Replaces the earlier first-step-only ccr_*_issue/fold_cca/merge_ctx diameter bridge (removed). The fire-and-forget #{async => true} path is kept for report_*/charging (distinct key).

Async PFCP create transportsmf_pfcp_context:create_session_async (landed foundation; its consumer, the establishment conversion, is deferred).

Stacked on #46. The #22 filter procedures consume this foundation in #56 (async-ue-bearer-22-filters).


%% create_session_async/5 — same rule build as create_session/5, but issues the request
%% asynchronously and returns a request id instead of blocking.
create_session_async(Handler, PCC, PCtx0, BearerMap0, Ctx)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an almost verbatim copy of session_establishment_request. Is there a reason not to refactor that function and make it reuseable for the async case?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Extracted the shared IE build into establishment_request_ies/5; both the blocking session_establishment_request/5 and create_session_async/5 call it. The blocking path now also decodes its response through the existing create_session_result/4 (which the async path already used), so accept/reject handling is single-sourced too — the two paths differ only in smf_sx_node:call vs send_request. pgw_SUITE 127/127.

Comment thread apps/smf_aaa/src/smf_aaa_pcf.erl Outdated
Comment on lines +74 to +83
issue(#pcf_ctx{app_id = AppId, handlers = Handlers0}, Session0, SOpts, Procedure, Opts0) ->
Opts = Opts0#{now => maps:get(now, Opts0, erlang:monotonic_time())},
Session1 = smf_aaa_session:session_merge(Session0, SOpts),
#{procedures := Procedures} = smf_aaa:get_application(AppId),
[SvcOpts = #{service := Service} | _] = smf_aaa_session:get_services(Procedure, Procedures),
Svc = smf_aaa:get_service(Service),
StepOpts = maps:merge(Opts, maps:merge(Svc, SvcOpts)),
Handler = maps:get(handler, Svc),
HState0 = maps:get(Handler, Handlers0, undefined),
Handler:ccr_initial_issue(Session1, StepOpts, HState0).

@next-nf next-nf Jul 22, 2026

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is totally wrong. The idea was to have the #{async => true} mechanism in the smc_aaa_session invoke call become switch to an async execution for the whole pipeline, not to break the pipeline concept and execute only the first step. This needs to be redone through the whole stack.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redone. #{pipeline_async => true} now switches the whole pipeline to async: run_pipeline runs in a monitored worker (smf_aaa_session:spawn_request + run_pipeline_async), and the procedure awaits one ReqId that binds the fully-folded pipeline result. The first-step ccr_*_issue/fold_cca/merge_ctx bridge is gone; smf_aaa_pcf:invoke/5 is the async-aware entry. This PR is now the foundation; the #22 procedures consume it in #56. Fire-and-forget #{async => true} stays for report_*/charging on a distinct key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant