fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40726?usp=email )
Change subject: Rename enft_kpi -> gtpu_kpi ......................................................................
Rename enft_kpi -> gtpu_kpi
Change-Id: I8a470d2c40dc4487c4de30b3cceeec333228935b Related: SYS#7307 --- M config/sys.config R src/gtpu_kpi.erl M src/osmo_s1gw_sup.erl M src/s1ap_proxy.erl M test/s1ap_proxy_test.erl 5 files changed, 37 insertions(+), 37 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/26/40726/1
diff --git a/config/sys.config b/config/sys.config index ef5a7d7..f73b33f 100644 --- a/config/sys.config +++ b/config/sys.config @@ -20,12 +20,12 @@ %% {pfcp_net_inst_core, << 16#09, "core-side" >>}, %% PFCP Network Instance IE value (to core) %% {pfcp_net_inst_access, << 16#0a, "radio-side" >>} %% PFCP Network Instance IE value (to access) %% -%% Optional NFT KPI configuration -%% {enft_kpi_enable, true}, %% whether to enable the NFT KPI module (default: false) -%% {enft_kpi_table_name, "osmo-s1gw"}, %% the NFT table name to be used by this process -%% {enft_kpi_ul_addr, s1ap}, %% GTP-U UL address: s1ap | sctp (default: learn from S1AP) -%% {enft_kpi_dl_addr, s1ap}, %% GTP-U DL address: s1ap | sctp (default: learn from S1AP) -%% {enft_kpi_interval, 3000} %% counter reporting interval (ms) +%% Optional GTP-U KPI configuration +%% {gtpu_kpi_enable, true}, %% whether to enable the GTP-U KPI module (default: false) +%% {gtpu_kpi_table_name, "osmo-s1gw"}, %% the NFT table name to be used by this process +%% {gtpu_kpi_ul_addr, s1ap}, %% GTP-U UL address: s1ap | sctp (default: learn from S1AP) +%% {gtpu_kpi_dl_addr, s1ap}, %% GTP-U DL address: s1ap | sctp (default: learn from S1AP) +%% {gtpu_kpi_interval, 3000} %% counter reporting interval (ms) ]}, %% ================================================================================ %% kernel config diff --git a/src/enft_kpi.erl b/src/gtpu_kpi.erl similarity index 99% rename from src/enft_kpi.erl rename to src/gtpu_kpi.erl index f8cf126..5aeb749 100644 --- a/src/enft_kpi.erl +++ b/src/gtpu_kpi.erl @@ -32,7 +32,7 @@ %% for the parts of the runtime libraries of Erlang/OTP used as well as %% that of the covered work.
--module(enft_kpi). +-module(gtpu_kpi). -behaviour(gen_server).
-export([init/1, diff --git a/src/osmo_s1gw_sup.erl b/src/osmo_s1gw_sup.erl index c746d7c..4f5ab0f 100644 --- a/src/osmo_s1gw_sup.erl +++ b/src/osmo_s1gw_sup.erl @@ -50,9 +50,9 @@ -define(ENV_DEFAULT_MME_REM_PORT, ?S1AP_PORT). -define(ENV_DEFAULT_PFCP_LOC_ADDR, "127.0.1.1"). -define(ENV_DEFAULT_PFCP_REM_ADDR, "127.0.1.2"). --define(ENV_DEFAULT_ENFT_KPI_ENABLE, false). --define(ENV_DEFAULT_ENFT_KPI_TABLE_NAME, "osmo-s1gw"). --define(ENV_DEFAULT_ENFT_KPI_INTERVAL, 3000). +-define(ENV_DEFAULT_GTPU_KPI_ENABLE, false). +-define(ENV_DEFAULT_GTPU_KPI_TABLE_NAME, "osmo-s1gw"). +-define(ENV_DEFAULT_GTPU_KPI_INTERVAL, 3000).
%% ------------------------------------------------------------------ %% supervisor API @@ -77,11 +77,11 @@ 5000, worker, [pfcp_peer]}, - EnftKpi = {enft_kpi, {enft_kpi, start_link, [enft_kpi_cfg()]}, + EnftKpi = {gtpu_kpi, {gtpu_kpi, start_link, [gtpu_kpi_cfg()]}, permanent, 5000, worker, - [enft_kpi]}, + [gtpu_kpi]},
s1gw_metrics:init(), {ok, {{one_for_one, 5, 10}, [SctpServer, PfcpPeer, EnftKpi]}}. @@ -115,10 +115,10 @@ priv => client_cfg()}.
--spec enft_kpi_cfg() -> enft_kpi:cfg(). -enft_kpi_cfg() -> - #{enable => osmo_s1gw:get_env(enft_kpi_enable, ?ENV_DEFAULT_ENFT_KPI_ENABLE), - table_name => osmo_s1gw:get_env(enft_kpi_table_name, ?ENV_DEFAULT_ENFT_KPI_TABLE_NAME), - interval => osmo_s1gw:get_env(enft_kpi_interval, ?ENV_DEFAULT_ENFT_KPI_INTERVAL)}. +-spec gtpu_kpi_cfg() -> gtpu_kpi:cfg(). +gtpu_kpi_cfg() -> + #{enable => osmo_s1gw:get_env(gput_kpi_enable, ?ENV_DEFAULT_GTPU_KPI_ENABLE), + table_name => osmo_s1gw:get_env(gtpu_kpi_table_name, ?ENV_DEFAULT_GTPU_KPI_TABLE_NAME), + interval => osmo_s1gw:get_env(gtpu_kpi_interval, ?ENV_DEFAULT_GTPU_KPI_INTERVAL)}.
%% vim:set ts=4 sw=4 et: diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl index e7a65e5..17403ec 100644 --- a/src/s1ap_proxy.erl +++ b/src/s1ap_proxy.erl @@ -368,7 +368,7 @@ handle_pdu({successfulOutcome, #'SuccessfulOutcome'{procedureCode = ?'id-S1Setup'}}, S) -> ?LOG_DEBUG("Processing S1 SETUP RESPONSE"), - enft_kpi_enb_register(S), + gtpu_kpi_enb_register(S), %% there's nothing to patch in this PDU, so we forward it as-is {forward, S};
@@ -695,8 +695,8 @@ #'E-RABSetupItemBearerSURes'{'e-RAB-ID' = ERABId, 'transportLayerAddress' = TLA_In, 'gTP-TEID' = << TEID_In:32/big >>} = C0, S) -> - %% indicate eNB's address to the enft_kpi module - enft_kpi_enb_set_addr({s1ap, tla_str(TLA_In)}), + %% indicate eNB's address to the gtpu_kpi module + gtpu_kpi_enb_set_addr({s1ap, tla_str(TLA_In)}), %% poke E-RAB FSM case erab_fsm_find(ERABId, S) of {ok, Pid} -> @@ -984,8 +984,8 @@ #'E-RABSetupItemCtxtSURes'{'e-RAB-ID' = ERABId, 'transportLayerAddress' = TLA_In, 'gTP-TEID' = << TEID_In:32/big >>} = C0, S) -> - %% indicate eNB's address to the enft_kpi module - enft_kpi_enb_set_addr({s1ap, tla_str(TLA_In)}), + %% indicate eNB's address to the gtpu_kpi module + gtpu_kpi_enb_set_addr({s1ap, tla_str(TLA_In)}), %% poke E-RAB FSM case erab_fsm_find(ERABId, S) of {ok, Pid} -> @@ -1094,37 +1094,37 @@ dict:find(UID, ERABs).
--spec enft_kpi_enb_register(proxy_state()) -> ok. -enft_kpi_enb_register(#proxy_state{conn_info = ConnInfo} = S) -> +-spec gtpu_kpi_enb_register(proxy_state()) -> ok. +gtpu_kpi_enb_register(#proxy_state{conn_info = ConnInfo} = S) -> %% register eNB using its Global-eNB-ID - ok = enft_kpi:enb_register(genb_id_str(S)), + ok = gtpu_kpi:enb_register(genb_id_str(S)), %% indicate UL/DL addresses EnbAddr = inet:ntoa(maps:get(addr, ConnInfo)), - enft_kpi_enb_set_addr({sctp, EnbAddr}). + gtpu_kpi_enb_set_addr({sctp, EnbAddr}).
--spec enft_kpi_enb_set_addr({Source, EnbAddr}) -> ok +-spec gtpu_kpi_enb_set_addr({Source, EnbAddr}) -> ok when Source :: s1ap | sctp, EnbAddr :: string(). -enft_kpi_enb_set_addr({Source, EnbAddr}) -> - enft_kpi_enb_set_addr(enft_kpi_ul_addr, {Source, ul, EnbAddr}), - enft_kpi_enb_set_addr(enft_kpi_dl_addr, {Source, dl, EnbAddr}), +gtpu_kpi_enb_set_addr({Source, EnbAddr}) -> + gtpu_kpi_enb_set_addr(gtpu_kpi_ul_addr, {Source, ul, EnbAddr}), + gtpu_kpi_enb_set_addr(gtpu_kpi_dl_addr, {Source, dl, EnbAddr}), ok.
--spec enft_kpi_enb_set_addr(EnvParam, {Source, ULDL, EnbAddr}) -> ok +-spec gtpu_kpi_enb_set_addr(EnvParam, {Source, ULDL, EnbAddr}) -> ok when EnvParam :: atom(), Source :: s1ap | sctp, ULDL :: ul | dl, EnbAddr :: string(). -enft_kpi_enb_set_addr(EnvParam, {Source, ULDL, EnbAddr}) -> +gtpu_kpi_enb_set_addr(EnvParam, {Source, ULDL, EnbAddr}) -> case osmo_s1gw:get_env(EnvParam, s1ap) of Source -> - ?LOG_DEBUG("NFT KPI ~p address ~p learned from ~p", + ?LOG_DEBUG("GTP-U KPI ~p address ~p learned from ~p", [ULDL, EnbAddr, Source]), - enft_kpi:enb_set_addr({ULDL, EnbAddr}); + gtpu_kpi:enb_set_addr({ULDL, EnbAddr}); Mode -> - ?LOG_DEBUG("NFT KPI ~p address mode ~p != ~p", [ULDL, Mode, Source]) + ?LOG_DEBUG("GTP-U KPI ~p address mode ~p != ~p", [ULDL, Mode, Source]) end.
%% vim:set ts=4 sw=4 et: diff --git a/test/s1ap_proxy_test.erl b/test/s1ap_proxy_test.erl index 1fc66f5..d606a18 100644 --- a/test/s1ap_proxy_test.erl +++ b/test/s1ap_proxy_test.erl @@ -23,7 +23,7 @@ pfcp_mock:mock_all(), exometer:start(), s1gw_metrics:init(), - enft_kpi:start_link(#{enable => false}), + gtpu_kpi:start_link(#{enable => false}), {ok, Pid} = s1ap_proxy:start_link(#{addr => {127,0,0,0}, port => 1337}), #{handler => Pid}. @@ -32,7 +32,7 @@ stop(#{handler := Pid}) -> s1ap_proxy:shutdown(Pid), exometer:stop(), - enft_kpi:shutdown(), + gtpu_kpi:shutdown(), pfcp_mock:unmock_all().