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


Change subject: s1ap_proxy: properly handle E-RAB RELEASE IND
......................................................................

s1ap_proxy: properly handle E-RAB RELEASE IND

Use the right release kind in the case of E-RAB RELEASE IND,
so that the E-RAB FSM can be terminated immediately.

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



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

diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl
index 5f7775e..1d0e1af 100644
--- a/src/s1ap_proxy.erl
+++ b/src/s1ap_proxy.erl
@@ -70,7 +70,8 @@

 -record(proxy_state, {erabs :: dict:dict(),
                       mme_ue_id :: undefined | mme_ue_id(),
-                      enb_ue_id :: undefined | enb_ue_id()
+                      enb_ue_id :: undefined | enb_ue_id(),
+                      rel_kind :: undefined | cmd | ind
                      }).

 -type proxy_state() :: #proxy_state{}.
@@ -443,7 +444,7 @@
 handle_ie(#'ProtocolIE-Field'{id = ?'id-E-RABToBeReleasedList',
                               value = Content}, S) ->
     %% This IE contains a list of E-RABItem
-    handle_ies(Content, ?'id-E-RABItem', S);
+    handle_ies(Content, ?'id-E-RABItem', S#proxy_state{rel_kind = cmd});

 handle_ie(#'ProtocolIE-Field'{id = ?'id-E-RABItem',
                               value = C}, S) ->
@@ -451,7 +452,7 @@
     #'E-RABItem'{'e-RAB-ID' = ERABId} = C,
     case erab_fsm_find(ERABId, S) of
         {ok, Pid} ->
-            ok = erab_fsm:erab_release_cmd(Pid),
+            ok = erab_fsm:erab_release(Pid, S#proxy_state.rel_kind),
             {{ok, C}, S};
         error ->
             ?LOG_ERROR("E-RAB ~p is not registered", [erab_uid(ERABId, S)]),
@@ -481,7 +482,7 @@
 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);
+    handle_ies(Content, ?'id-E-RABItem', S#proxy_state{rel_kind = ind});

 %% E-RAB MODIFICATION INDICATION related IEs
 handle_ie(#'ProtocolIE-Field'{id = ?'id-E-RABToBeModifiedListBearerModInd',
diff --git a/test/s1ap_proxy_test.erl b/test/s1ap_proxy_test.erl
index 9e94716..917b63e 100644
--- a/test/s1ap_proxy_test.erl
+++ b/test/s1ap_proxy_test.erl
@@ -111,12 +111,10 @@
     %% [eNB -> MME] E-RAB RELEASE INDICATION
     ReleaseInd = e_rab_release_ind_pdu(),

-    %% TODO: make sure that the E-RAB FSM has been terminated
-    %% FIXME: erab_fsm does not tear down immediately, but after a timeout
-
     [?_assertMatch({forward, _}, s1ap_proxy:process_pdu(Pid, SetupReq)),
      ?_assertMatch({forward, _}, s1ap_proxy:process_pdu(Pid, SetupRsp)),
-     ?_assertEqual({forward, ReleaseInd}, s1ap_proxy:process_pdu(Pid, 
ReleaseInd))].
+     ?_assertEqual({forward, ReleaseInd}, s1ap_proxy:process_pdu(Pid, 
ReleaseInd)),
+     ?_assertEqual([], s1ap_proxy:fetch_erab_list(Pid))].


 test_e_rab_modify_ind(#{handler := Pid}) ->

--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/38767?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: Id1b77ef59818d6416326477a25e9866ab636b3ad
Gerrit-Change-Number: 38767
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>

Reply via email to