fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42447?usp=email )
Change subject: enb_proxy: add missing mme_info() to proxy_info() ......................................................................
enb_proxy: add missing mme_info() to proxy_info()
As a bonus, `tried_mmes` now only serves its actual purpose - tracking which MMEs have already been tried for selection filtering - rather than being abused as a way to retrieve the current MME name.
Change-Id: Ibbb293d9e68b7c3a8c3ca7ee73132dbda3f2bf97 Related: SYS#7066 --- M src/enb_proxy.erl 1 file changed, 9 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/47/42447/1
diff --git a/src/enb_proxy.erl b/src/enb_proxy.erl index c281b33..40d446a 100644 --- a/src/enb_proxy.erl +++ b/src/enb_proxy.erl @@ -74,6 +74,7 @@
-record(state, {enb_conn_info :: sctp_server:conn_info(), mme_conn_info :: undefined | mme_conn_info(), + mme_info :: undefined | mme_registry:mme_info(), s1setup_req :: undefined | binary(), tried_mmes :: [mme_registry:mme_name()], enb_tacs :: undefined | [s1ap_utils:tac()], @@ -217,6 +218,7 @@ enb_registry:notify_mme_connecting(S#state.enb_handle, MmeInfo), {next_state, ?FUNCTION_NAME, %% loop transition to enable state_timeout S#state{sock = Sock, + mme_info = MmeInfo, mme_conn_info = undefined, tried_mmes = [MmeName | TriedMMEs]}, [{state_timeout, 2_000, conn_est_timeout}]}; @@ -232,9 +234,9 @@ %% Handle connection establishment timeout connecting(state_timeout, conn_est_timeout, S) -> ?LOG_ERROR("MME ~p: timeout establishing connection", - [hd(S#state.tried_mmes)]), + [maps:get(name, S#state.mme_info)]), ctr_inc(?S1GW_CTR_ENB_PROXY_CONN_EST_TIMEOUT, S), - s1gw_metrics:ctr_inc(?S1GW_CTR_MME_CONN_EST_TIMEOUT(hd(S#state.tried_mmes))), + s1gw_metrics:ctr_inc(?S1GW_CTR_MME_CONN_EST_TIMEOUT(maps:get(name, S#state.mme_info))), %% re-enter the state to try again (or another MME) repeat_state_and_data;
@@ -250,7 +252,7 @@ {[], #sctp_assoc_change{state = ConnState, assoc_id = Aid}}}, #state{sock = Socket} = S) -> - MmeName = hd(S#state.tried_mmes), + MmeName = maps:get(name, S#state.mme_info), case ConnState of comm_up -> {ok, {MmeLAddr, MmeLPort}} = inet:sockname(Socket), @@ -289,7 +291,7 @@ wait_s1setup_rsp(state_timeout, s1setup_rsp_timeout, S) -> ?LOG_ERROR("Timeout waiting for S1 SETUP RESPONSE from MME"), ctr_inc(?S1GW_CTR_ENB_PROXY_S1_SETUP_RSP_TIMEOUT, S), - s1gw_metrics:ctr_inc(?S1GW_CTR_MME_S1_SETUP_RSP_TIMEOUT(hd(S#state.tried_mmes))), + s1gw_metrics:ctr_inc(?S1GW_CTR_MME_S1_SETUP_RSP_TIMEOUT(maps:get(name, S#state.mme_info))), %% re-enter state 'connecting' to try again (or another MME) {next_state, connecting, S};
@@ -314,13 +316,13 @@ {{?'id-S1Setup', successfulOutcome}, _IEs} -> ?LOG_INFO("Rx S1 SETUP RESPONSE from MME"), ctr_inc(?S1GW_CTR_ENB_PROXY_S1_SETUP_RSP, S), - s1gw_metrics:ctr_inc(?S1GW_CTR_MME_S1_SETUP_RSP(hd(S#state.tried_mmes))), + s1gw_metrics:ctr_inc(?S1GW_CTR_MME_S1_SETUP_RSP(maps:get(name, S#state.mme_info))), sctp_send_from_mme(Data, S), {next_state, connected, S}; {{?'id-S1Setup', unsuccessfulOutcome}, _IEs} -> ?LOG_NOTICE("Rx S1 SETUP FAILURE from MME"), ctr_inc(?S1GW_CTR_ENB_PROXY_S1_SETUP_FAILURE, S), - s1gw_metrics:ctr_inc(?S1GW_CTR_MME_S1_SETUP_FAILURE(hd(S#state.tried_mmes))), + s1gw_metrics:ctr_inc(?S1GW_CTR_MME_S1_SETUP_FAILURE(maps:get(name, S#state.mme_info))), %% do *not* forward the FAILURE to the eNB %% re-enter state 'connecting' to try again (or another MME) {next_state, connecting, S}; @@ -411,7 +413,7 @@ enb_handle => S#state.enb_handle, enb_conn_info => S#state.enb_conn_info, mme_conn_info => S#state.mme_conn_info, - %% TODO: mme_info => S#state.mme_info, + mme_info => S#state.mme_info, genb_id_str => S#state.genb_id_str }, Reply = maps:filter(fun(_K, V) -> V =/= undefined end, Info),