fixeria submitted this change.

View Change

Approvals: pespin: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified
erab_fsm: session_modify(): split PFCP PDU handling

This patch prepares for a follow-up change adding the MME-initiated
E-RAB modification logic. Handle the successful modification scenario
in a separate function, which will be extended further soon.

Change-Id: I04fec627300fa9240e6b2bf22ff9ae08dd4c0f0d
---
M src/erab_fsm.erl
1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/erab_fsm.erl b/src/erab_fsm.erl
index a479cea..b249cd4 100644
--- a/src/erab_fsm.erl
+++ b/src/erab_fsm.erl
@@ -277,24 +277,23 @@
{shutdown, timeout},
{reply, From, {error, {timeout, ?FUNCTION_NAME}}}};

-session_modify(info, #pfcp{} = PDU,
+session_modify(info, #pfcp{type = session_modification_response,
+ seid = SEID_Rsp, %% matches F-SEID we sent in the ESTABLISH Req
+ ie = #{pfcp_cause := 'Request accepted'}},
#erab_state{from = From,
seid_loc = SEID_Rsp,
c2u = C2U} = S) ->
- case PDU of
- #pfcp{type = session_modification_response,
- seid = SEID_Rsp, %% matches F-SEID we sent in the ESTABLISH Req
- ie = #{pfcp_cause := 'Request accepted'}} ->
- ?LOG_DEBUG("PFCP session modified"),
- {next_state, erab_setup,
- S#erab_state{from = undefined},
- [{reply, From, {ok, C2U}}]};
- _ ->
- ?LOG_ERROR("Rx unexpected PFCP PDU: ~p", [PDU]),
- {stop_and_reply,
- {shutdown, unexp_pdu},
- {reply, From, {error, {unexp_pdu, ?FUNCTION_NAME}}}}
- end;
+ ?LOG_DEBUG("PFCP session modified"),
+ {next_state, erab_setup,
+ S#erab_state{from = undefined},
+ [{reply, From, {ok, C2U}}]};
+
+session_modify(info, #pfcp{} = PDU,
+ #erab_state{from = From}) ->
+ ?LOG_ERROR("Rx unexpected PFCP PDU: ~p", [PDU]),
+ {stop_and_reply,
+ {shutdown, unexp_pdu},
+ {reply, From, {error, {unexp_pdu, ?FUNCTION_NAME}}}};

session_modify(Event, EventData, S) ->
handle_event(?FUNCTION_NAME, Event, EventData, S).

To view, visit change 39124. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I04fec627300fa9240e6b2bf22ff9ae08dd4c0f0d
Gerrit-Change-Number: 39124
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>