async AAA invoke foundation + PFCP create transport (foundation for #22) - #48
Conversation
|
|
||
| %% 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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
| 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). |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
9569f12 to
b38ac0c
Compare
0266ba5 to
8efa205
Compare
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 oneReqId; the context awaits it and binds the fully-folded pipeline result — not the first step. Replaces the earlier first-step-onlyccr_*_issue/fold_cca/merge_ctxdiameter bridge (removed). The fire-and-forget#{async => true}path is kept forreport_*/charging (distinct key).Async PFCP create transport —
smf_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).