fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/38242?usp=email )


Change subject: s1ap_proxy: handle E-RAB RELEASE INDICATION
......................................................................

s1ap_proxy: handle E-RAB RELEASE INDICATION

Change-Id: Ibaf4cfaad9edfadf8abadeffe19076501d696607
---
M src/s1ap_proxy.erl
M test/s1ap_proxy_test.erl
2 files changed, 48 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw 
refs/changes/42/38242/1

diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl
index 46a7c79..e0ef45a 100644
--- a/src/s1ap_proxy.erl
+++ b/src/s1ap_proxy.erl
@@ -177,6 +177,16 @@
     NewContent = Content#'E-RABReleaseResponse'{protocolIEs = IEs},
     handle_pdu_new(Data, {Outcome, Pdu#'SuccessfulOutcome'{value = 
NewContent}}, S1);

+%% 9.1.3.7 E-RAB RELEASE INDICATION
+handle_pdu(Data, {Outcome = initiatingMessage,
+                  #'InitiatingMessage'{procedureCode = 
?'id-E-RABReleaseIndication',
+                                       value = Content} = Pdu}, S0) ->
+    ?LOG_DEBUG("Processing E-RAB RELEASE INDICATION"),
+    {IEs, S1} = handle_ies(Content#'E-RABReleaseIndication'.protocolIEs,
+                           ?'id-E-RABReleasedList', S0),
+    NewContent = Content#'E-RABReleaseCommand'{protocolIEs = IEs},
+    handle_pdu_new(Data, {Outcome, Pdu#'InitiatingMessage'{value = 
NewContent}}, S1);
+
 %% 9.1.3.8 E-RAB MODIFICATION INDICATION
 handle_pdu(Data, {Outcome = initiatingMessage,
                   #'InitiatingMessage'{procedureCode = 
?'id-E-RABModificationIndication',
@@ -302,6 +312,12 @@
     end,
     {Content, S};

+%% 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 5f6167d..93702df 100644
--- a/test/s1ap_proxy_test.erl
+++ b/test/s1ap_proxy_test.erl
@@ -33,7 +33,9 @@
      {"E-RAB SETUP REQUEST/RESPONSE",
       ?TC(fun test_e_rab_setup/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",
@@ -65,7 +67,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:handle_pdu(SetupReqIn, S0),
@@ -88,6 +90,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:handle_pdu(SetupReqIn, S0),
+
+    %% [eNB -> MME] E-RAB SETUP RESPONSE
+    SetupRspIn = e_rab_setup_rsp_pdu(?ADDR_U2A, ?TEID_U2A),
+    {_, S2} = s1ap_proxy:handle_pdu(SetupRspIn, S1),
+
+    %% [eNB -> MME] E-RAB RELEASE INDICATION
+    ReleaseInd = e_rab_release_ind_pdu(),
+    {ReleaseIndOut, _S3} = s1ap_proxy:handle_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),
@@ -185,6 +205,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) ->

--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/38242?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: Ibaf4cfaad9edfadf8abadeffe19076501d696607
Gerrit-Change-Number: 38242
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>

Reply via email to