fixeria has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/38241?usp=email )
Change subject: s1ap_proxy: handle E-RAB RELEASE INDICATION ......................................................................
s1ap_proxy: handle E-RAB RELEASE INDICATION
Change-Id: I13584620e28edf529325dc661c4b40d09acacc3f --- M src/s1ap_proxy.erl M test/s1ap_proxy_test.erl 2 files changed, 54 insertions(+), 2 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl index 0faa42f..4758484 100644 --- a/src/s1ap_proxy.erl +++ b/src/s1ap_proxy.erl @@ -210,6 +210,22 @@ {forward, S1} %% XXX: forward as-is or drop? end;
+%% 9.1.3.7 E-RAB RELEASE INDICATION +handle_pdu({Outcome = initiatingMessage, + #'InitiatingMessage'{procedureCode = ?'id-E-RABReleaseIndication', + value = C0} = Msg}, S0) -> + ?LOG_DEBUG("Processing E-RAB RELEASE INDICATION"), + case handle_ies(C0#'E-RABReleaseIndication'.protocolIEs, + ?'id-E-RABReleasedList', S0) of + {{ok, IEs}, S1} -> + C1 = C0#'E-RABReleaseIndication'{protocolIEs = IEs}, + PDU = {Outcome, Msg#'InitiatingMessage'{value = C1}}, + {{forward, PDU}, S1}; %% forward patched PDU + {{error, Reason}, S1} -> + ?LOG_NOTICE("Failed to process E-RAB RELEASE INDICATION: ~p", [Reason]), + {forward, S1} %% XXX: forward as-is or drop? + end; + %% 9.1.3.8 E-RAB MODIFICATION INDICATION handle_pdu({Outcome = initiatingMessage, #'InitiatingMessage'{procedureCode = ?'id-E-RABModificationIndication', @@ -361,6 +377,12 @@ {{error, erab_not_registered}, S} end;
+%% 9.1.3.7 E-RAB RELEASE INDICATION related IEs +handle_ie(#'ProtocolIE-Field'{id = ?'id-E-RABReleasedList', + value = Content}, S) -> + %% This IE contains a list of E-RABItem + handle_ies(Content, ?'id-E-RABItem', S); + %% E-RAB MODIFICATION INDICATION related IEs handle_ie(#'ProtocolIE-Field'{id = ?'id-E-RABToBeModifiedListBearerModInd', value = Content}, S) -> diff --git a/test/s1ap_proxy_test.erl b/test/s1ap_proxy_test.erl index aa3763e..04d52df 100644 --- a/test/s1ap_proxy_test.erl +++ b/test/s1ap_proxy_test.erl @@ -35,7 +35,9 @@ {"E-RAB SETUP REQUEST (failure)", ?TC(fun test_e_rab_setup_req_fail/1)}, {"E-RAB RELEASE COMMAND/RESPONSE", - ?TC(fun test_e_rab_release/1)}, + ?TC(fun test_e_rab_release_cmd/1)}, + {"E-RAB RELEASE INDICATION", + ?TC(fun test_e_rab_release_ind/1)}, {"E-RAB MODIFICATION INDICATION", ?TC(fun test_e_rab_modify_ind/1)}, {"INITIAL CONTEXT SETUP REQUEST/RESPONSE", @@ -84,7 +86,7 @@ [?_assertEqual(SetupRspExp, SetupRspOut)].
-test_e_rab_release(S0) -> +test_e_rab_release_cmd(S0) -> %% [eNB <- MME] E-RAB SETUP REQUEST SetupReqIn = e_rab_setup_req_pdu(?ADDR_U2C, ?TEID_U2C), {_, S1} = s1ap_proxy:process_pdu(SetupReqIn, S0), @@ -107,6 +109,24 @@ ?_assertEqual(ReleaseRsp, ReleaseRspOut)].
+test_e_rab_release_ind(S0) -> + %% [eNB <- MME] E-RAB SETUP REQUEST + SetupReqIn = e_rab_setup_req_pdu(?ADDR_U2C, ?TEID_U2C), + {_, S1} = s1ap_proxy:process_pdu(SetupReqIn, S0), + + %% [eNB -> MME] E-RAB SETUP RESPONSE + SetupRspIn = e_rab_setup_rsp_pdu(?ADDR_U2A, ?TEID_U2A), + {_, S2} = s1ap_proxy:process_pdu(SetupRspIn, S1), + + %% [eNB -> MME] E-RAB RELEASE INDICATION + ReleaseInd = e_rab_release_ind_pdu(), + {{forward, ReleaseIndOut}, _S3} = s1ap_proxy:process_pdu(ReleaseInd, S2), + + %% TODO: make sure that the E-RAB FSM has been terminated + + [?_assertEqual(ReleaseInd, ReleaseIndOut)]. + + test_e_rab_modify_ind(S0) -> %% [eNB -> MME] E-RAB MODIFICATION INDICATION ModifyIndIn = e_rab_modify_ind_pdu(?ADDR_U2A, ?TEID_U2A), @@ -214,6 +234,16 @@ >>.
+%% [eNB -> MME] E-RAB RELEASE INDICATION +%% TODO: make E-RAB IDs configurable +e_rab_release_ind_pdu() -> + << 16#00, 16#08, 16#00, 16#1a, 16#00, 16#00, 16#03, 16#00, + 16#00, 16#00, 16#02, 16#00, 16#07, 16#00, 16#08, 16#00, + 16#02, 16#00, 16#09, 16#00, 16#6e, 16#40, 16#07, 16#00, + 16#00, 16#23, 16#40, 16#02, 16#0c, 16#40 + >>. + + %% [eNB -> MME] E-RAB MODIFICATION INDICATION e_rab_modify_ind_pdu(TLA, TEID) when is_binary(TLA), is_integer(TEID) ->