fixeria has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40715?usp=email )
Change subject: s1ap_proxy_test: also test per-eNB counters ......................................................................
s1ap_proxy_test: also test per-eNB counters
Change-Id: I59f35b3301fcc04845709c55cc1e2cf0055cb0e3 Related: SYS#7065 --- M test/s1ap_proxy_test.erl 1 file changed, 39 insertions(+), 7 deletions(-)
Approvals: pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved laforge: Looks good to me, but someone else must approve
diff --git a/test/s1ap_proxy_test.erl b/test/s1ap_proxy_test.erl index 3ea8b89..55c9b40 100644 --- a/test/s1ap_proxy_test.erl +++ b/test/s1ap_proxy_test.erl @@ -5,9 +5,14 @@ -include("pfcp_mock.hrl").
+-define(GlobalENBId, "001-01-0"). + -define(_assertMetric(Name, Value), ?_assertEqual(Value, s1gw_metrics:get_current_value(Name))).
+-define(_assertMetricENB(Name, Value), + ?_assertMetric(s1gw_metrics:enb_metric(Name, ?GlobalENBId), Value)). +
%% ------------------------------------------------------------------ %% setup functions @@ -79,9 +84,14 @@ %% Expect the PDUs to be proxied unmodified [?_assertEqual({forward, SetupReq}, s1ap_proxy:process_pdu(Pid, SetupReq)), ?_assertEqual({forward, SetupRsp}, s1ap_proxy:process_pdu(Pid, SetupRsp)), + %% global counters ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, 2), ?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_ALL, 2), - ?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_UNMODIFIED, 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_OUT_PKT_FWD_ALL, 2), + ?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_UNMODIFIED, 2)].
test_e_rab_setup(#{handler := Pid}) -> @@ -92,13 +102,24 @@ SetupRspIn = e_rab_setup_rsp_pdu(?ADDR_U2A, ?TEID_U2A), SetupRspExp = e_rab_setup_rsp_pdu(?ADDR_C2U, ?TEID_C2U),
- [?_assertEqual({forward, SetupReqExp}, s1ap_proxy:process_pdu(Pid, SetupReqIn)), + [?_assertMatch({forward, _}, s1ap_proxy:process_pdu(Pid, s1_setup_req_pdu())), + ?_assertMatch({forward, _}, s1ap_proxy:process_pdu(Pid, s1_setup_rsp_pdu())), + ?_assertEqual({forward, SetupReqExp}, s1ap_proxy:process_pdu(Pid, SetupReqIn)), ?_assertEqual({forward, SetupRspExp}, s1ap_proxy:process_pdu(Pid, SetupRspIn)), - ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, 2), + %% global counters + ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, 2 + 2), ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ERAB_SETUP_REQ, 1), ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ERAB_SETUP_RSP, 1), - ?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_ALL, 2), + ?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_ALL, 2 + 2), ?_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), + ?_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), + ?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_PROC, 2), + ?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_UNMODIFIED, 2), ?_assertMatch({ok, _}, s1ap_proxy:fetch_erab(Pid, {7, 9, 6})), ?_assertMatch([_], s1ap_proxy:fetch_erab_list(Pid))].
@@ -311,13 +332,24 @@ InitCtxSetupRspIn = initial_context_setup_rsp_pdu(?ADDR_U2A, ?TEID_U2A), InitCtxSetupRspExp = initial_context_setup_rsp_pdu(?ADDR_C2U, ?TEID_C2U),
- [?_assertEqual({forward, InitCtxSetupReqExp}, s1ap_proxy:process_pdu(Pid, InitCtxSetupReqIn)), + [?_assertMatch({forward, _}, s1ap_proxy:process_pdu(Pid, s1_setup_req_pdu())), + ?_assertMatch({forward, _}, s1ap_proxy:process_pdu(Pid, s1_setup_rsp_pdu())), + ?_assertEqual({forward, InitCtxSetupReqExp}, s1ap_proxy:process_pdu(Pid, InitCtxSetupReqIn)), ?_assertEqual({forward, InitCtxSetupRspExp}, s1ap_proxy:process_pdu(Pid, InitCtxSetupRspIn)), - ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, 2), + %% global counters + ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_ALL, 2 + 2), ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_INIT_CTX_REQ, 1), ?_assertMetric(?S1GW_CTR_S1AP_PROXY_IN_PKT_INIT_CTX_RSP, 1), - ?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_ALL, 2), + ?_assertMetric(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_ALL, 2 + 2), ?_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_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), + ?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_PROC, 2), + ?_assertMetricENB(?S1GW_CTR_S1AP_PROXY_OUT_PKT_FWD_UNMODIFIED, 2), ?_assertMatch([_], s1ap_proxy:fetch_erab_list(Pid))].