fixeria has submitted this change. (
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40717?usp=email )
Change subject: s1ap_proxy: fix per-eNB ?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL
......................................................................
s1ap_proxy: fix per-eNB ?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL
The per-eNB variant of ?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL was one-less,
not counting the very first S1 Setup Req. The reason is that only
the global variant is incremented before Global-eNB-ID is known.
Change-Id: If57f0c43f41d5f38759f9746a4f6299d3233a450
Related: SYS#7065
---
M src/s1ap_proxy.erl
M test/s1ap_proxy_test.erl
2 files changed, 13 insertions(+), 4 deletions(-)
Approvals:
fixeria: Looks good to me, approved
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl
index 9b7a105..953cf66 100644
--- a/src/s1ap_proxy.erl
+++ b/src/s1ap_proxy.erl
@@ -661,7 +661,16 @@
set_logging_prefix("eNB " ++ GlobalENBId),
%% register per-eNB metrics
ctr_reg_all(GlobalENBId),
- {{ok, C}, S1#proxy_state{genb_id_str = GlobalENBId}};
+ %% increment per-eNB ?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, if needed
+ %% this is needed to count S1 Setup Req correctly
+ S2 = case S0#proxy_state.genb_id_str of
+ GlobalENBId -> S1;
+ _ ->
+ Ctr = s1gw_metrics:enb_metric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, GlobalENBId),
+ s1gw_metrics:ctr_inc(Ctr),
+ S1#proxy_state{genb_id_str = GlobalENBId}
+ end,
+ {{ok, C}, S2};
%% E-RAB SETUP REQUEST related IEs
handle_ie([?'id-E-RABToBeSetupListBearerSUReq'], C, S) ->
diff --git a/test/s1ap_proxy_test.erl b/test/s1ap_proxy_test.erl
index 55c9b40..61f4511 100644
--- a/test/s1ap_proxy_test.erl
+++ b/test/s1ap_proxy_test.erl
@@ -89,7 +89,7 @@
?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_ALL, 2),
?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_UNMODIFIED, 2),
%% per-eNB counters
-%% ?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, 2),
+ ?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, 2),
?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_ALL, 2),
?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_UNMODIFIED, 2)].
@@ -114,7 +114,7 @@
?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_PROC, 2),
?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_UNMODIFIED, 2),
%% per-eNB counters
-%% ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, 2 + 2),
+ ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, 2 + 2),
?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_IN_PKT_ERAB_SETUP_REQ, 1),
?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_IN_PKT_ERAB_SETUP_RSP, 1),
?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_ALL, 2 + 2),
@@ -344,7 +344,7 @@
?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_PROC, 2),
?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_UNMODIFIED, 2),
%% per-eNB counters
-%% ?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, 2 + 2),
+ ?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, 2 + 2),
?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_IN_PKT_INIT_CTX_REQ, 1),
?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_IN_PKT_INIT_CTX_RSP, 1),
?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_ALL, 2 + 2),
--
To view, visit
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40717?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: If57f0c43f41d5f38759f9746a4f6299d3233a450
Gerrit-Change-Number: 40717
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>