laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/38239?usp=email )

Change subject: s1ap_proxy: print unique E-RAB ID in error messages
......................................................................

s1ap_proxy: print unique E-RAB ID in error messages

Include the {MME,ENB}-UE-S1AP-ID when printing error messages.
Printing E-RAB-ID may be misleading.

Change-Id: I7327e25ea407b3a21706e8b5e4487135675d91d5
---
M src/s1ap_proxy.erl
1 file changed, 14 insertions(+), 11 deletions(-)

Approvals:
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl
index c386f29..a98514c 100644
--- a/src/s1ap_proxy.erl
+++ b/src/s1ap_proxy.erl
@@ -59,6 +59,7 @@
 -type mme_ue_id() :: 0..16#ffffffff.
 -type enb_ue_id() :: 0..16#ffffff.
 -type erab_id() :: 0..16#ff.
+-type erab_uid() :: {mme_ue_id(), enb_ue_id(), erab_id()}.

 -record(proxy_state, {erabs :: dict:dict(),
                       mme_ue_id :: undefined | mme_ue_id(),
@@ -107,6 +108,12 @@
 %% private API
 %% ------------------------------------------------------------------

+-spec erab_uid(erab_id(), proxy_state()) -> erab_uid().
+erab_uid(ERABId, #proxy_state{mme_ue_id = MmeUeId,
+                              enb_ue_id = EnbUeId}) ->
+    {MmeUeId, EnbUeId, ERABId}.
+
+
 %% Encode an S1AP PDU
 -spec encode_pdu(s1ap_pdu()) -> {ok, binary()} |
                                 {error, {asn1, tuple()}}.
@@ -282,7 +289,7 @@
         {ok, Pid} ->
             ok = erab_fsm:erab_release_req(Pid);
         error ->
-            ?LOG_ERROR("E-RAB-ID ~p is not registered", [ERABId])
+            ?LOG_ERROR("E-RAB ~p is not registered", [erab_uid(ERABId, S)])
     end,
     {Content, S};

@@ -300,7 +307,7 @@
         {ok, Pid} ->
             ok = erab_fsm:erab_release_rsp(Pid);
         error ->
-            ?LOG_ERROR("E-RAB-ID ~p is not registered", [ERABId])
+            ?LOG_ERROR("E-RAB ~p is not registered", [erab_uid(ERABId, S)])
     end,
     {Content, S};

@@ -361,7 +368,7 @@
             C0#'E-RABSetupItemCtxtSURes'{'transportLayerAddress' = TLA_Out,
                                          'gTP-TEID' = << TEID_Out:32/big >>};
         error ->
-            ?LOG_ERROR("E-RAB-ID ~p is not registered", [ERABId]),
+            ?LOG_ERROR("E-RAB ~p is not registered", [erab_uid(ERABId, S)]),
             C0 %% XXX: proxy as-is or drop?
     end,
     {C1, S};
@@ -400,19 +407,15 @@


 -spec erab_fsm_start_reg(erab_id(), proxy_state()) -> {pid(), proxy_state()}.
-erab_fsm_start_reg(RABId, #proxy_state{erabs = ERABs,
-                                       mme_ue_id = MmeUeId,
-                                       enb_ue_id = EnbUeId} = S) ->
-    UID = {MmeUeId, EnbUeId, RABId},
+erab_fsm_start_reg(RABId, #proxy_state{erabs = ERABs} = S) ->
+    UID = erab_uid(RABId, S),
     {ok, Pid} = erab_fsm:start_link(UID),
     {Pid, S#proxy_state{erabs = dict:store(UID, Pid, ERABs)}}.


 -spec erab_fsm_find(erab_id(), proxy_state()) -> {ok, pid()} | error.
-erab_fsm_find(RABId, #proxy_state{erabs = ERABs,
-                                  mme_ue_id = MmeUeId,
-                                  enb_ue_id = EnbUeId}) ->
-    UID = {MmeUeId, EnbUeId, RABId},
+erab_fsm_find(RABId, #proxy_state{erabs = ERABs} = S) ->
+    UID = erab_uid(RABId, S),
     dict:find(UID, ERABs).

 %% vim:set ts=4 sw=4 et:

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

Gerrit-MessageType: merged
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I7327e25ea407b3a21706e8b5e4487135675d91d5
Gerrit-Change-Number: 38239
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to