summaryrefslogtreecommitdiffstats
path: root/bsc
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-08-12 15:30:17 +0200
committerlaforge <laforge@osmocom.org>2020-08-13 15:02:15 +0000
commitebdecc0309aa777b62177296fda17a49991ea73d (patch)
tree2257e00191a6f6253e8dcc40f1560e34fccf0ff6 /bsc
parent742372880b7b796c630ff2d2f4c090776aa29b51 (diff)
bsc: Add statsd checker and use it in TC_assignment_sign
Diffstat (limited to 'bsc')
-rw-r--r--bsc/BSC_Tests.default10
-rw-r--r--bsc/BSC_Tests.ttcn21
-rw-r--r--bsc/MSC_ConnectionHandler.ttcn4
-rw-r--r--bsc/README.md3
-rwxr-xr-xbsc/gen_links.sh1
-rw-r--r--bsc/osmo-bsc.cfg10
-rwxr-xr-xbsc/regen_makefile.sh2
7 files changed, 48 insertions, 3 deletions
diff --git a/bsc/BSC_Tests.default b/bsc/BSC_Tests.default
index 8818359..c5d1559 100644
--- a/bsc/BSC_Tests.default
+++ b/bsc/BSC_Tests.default
@@ -17,8 +17,18 @@ mtc.FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
*.BSCVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
*.BSCVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
*.BSCVTY.PROMPT1 := "OsmoBSC> "
+*.STATSVTY.CTRL_MODE := "client"
+*.STATSVTY.CTRL_HOSTNAME := "127.0.0.1"
+*.STATSVTY.CTRL_PORTNUM := "4242"
+*.STATSVTY.CTRL_LOGIN_SKIPPED := "yes"
+*.STATSVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
+*.STATSVTY.CTRL_READMODE := "buffered"
+*.STATSVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.STATSVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
+*.STATSVTY.PROMPT1 := "OsmoBSC> "
[MODULE_PARAMETERS]
Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoBSC";
+StatsD_Checker.mp_enable_stats := true;
[EXECUTE]
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 22c94d4..003df49 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -45,6 +45,11 @@ import from Osmocom_CTRL_Functions all;
import from Osmocom_CTRL_Types all;
import from Osmocom_CTRL_Adapter all;
+import from StatsD_Types all;
+import from StatsD_CodecPort all;
+import from StatsD_CodecPort_CtrlFunct all;
+import from StatsD_Checker all;
+
import from Osmocom_VTY_Functions all;
import from TELNETasp_PortType all;
@@ -471,6 +476,9 @@ type component test_CT extends CTRL_Adapter_CT {
var MGCP_Emulation_CT vc_MGCP;
port TELNETasp_PT BSCVTY;
+ /* StatsD */
+ var StatsD_Checker_CT vc_STATSD;
+
var RAN_Adapter g_bssap[NUM_MSC];
/* for old legacy-tests only */
port BSSAP_CODEC_PT BSSAP;
@@ -504,6 +512,8 @@ modulepar {
integer mp_bsc_rsl_port := 3003;
/* port number to which to establish the IPA CTRL connection */
integer mp_bsc_ctrl_port := 4249;
+ /* port number to which to listen for STATSD metrics */
+ integer mp_bsc_statsd_port := 8125;
/* IP address at which the test binds */
charstring mp_test_ip := "127.0.0.1";
@@ -898,6 +908,8 @@ function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false, boolea
}
var my_BooleanList allow_attach := { false, false, false };
+ f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port);
+
for (bssap_idx := 0; bssap_idx < nr_msc; bssap_idx := bssap_idx+1) {
allow_attach[bssap_idx] := true;
/* Call a function of our 'parent component' RAN_Adapter_CT to start the
@@ -2777,6 +2789,7 @@ private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx
connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT);
connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT);
connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI);
+ connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC);
}
function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit)
@@ -2938,7 +2951,15 @@ private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr {
var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit);
var PDU_BSSAP ass_cmd := f_gen_ass_req();
ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL);
+
+ f_statsd_reset();
f_establish_fully(ass_cmd, exp_compl);
+
+ var StatsDExpects expect := {
+ { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1},
+ { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1}
+ };
+ f_statsd_expect(expect);
}
testcase TC_assignment_sign() runs on test_CT {
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 7b8f087..bf96eff 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -30,6 +30,8 @@ import from MGCP_Templates all;
import from MGCP_Emulation all;
import from SDP_Types all;
+import from StatsD_Checker all;
+
import from RSL_Emulation all;
import from RSL_Types all;
@@ -409,7 +411,7 @@ altstep as_Media() runs on MSC_ConnHdlr {
/* this component represents a single subscriber connection at the MSC.
* There is a 1:1 mapping between SCCP connections and RAN_ConnHdlr components.
* We inherit all component variables, ports, functions, ... from RAN_ConnHdlr */
-type component MSC_ConnHdlr extends RAN_ConnHdlr, RSL_DchanHdlr, MGCP_ConnHdlr {
+type component MSC_ConnHdlr extends RAN_ConnHdlr, RSL_DchanHdlr, MGCP_ConnHdlr, StatsD_ConnHdlr {
/* SCCP Connecction Identifier for the underlying SCCP connection */
var integer g_sccp_conn_id;
diff --git a/bsc/README.md b/bsc/README.md
index 015687c..47714e9 100644
--- a/bsc/README.md
+++ b/bsc/README.md
@@ -8,6 +8,7 @@
* MGW side: MGCP (emulates MGW side)
* VTY
* CTRL
+ * StatsD
{% dot bsc_tests.svg
digraph G {
@@ -22,6 +23,7 @@ digraph G {
ATS -> BSC [label="A-bis RSL"];
ATS -> BSC [label="CTRL"];
ATS -> BSC [label="VTY"];
+ BSC -> ATS [label="StatsD"];
ATS -> STP [label="A BSSAP\nSCCP/M3UA"];
BSC -> STP [label="A BSSAP\nSCCP/M3UA"];
}
@@ -39,6 +41,7 @@ digraph G {
ATS -> BSC [label="A-bis RSL"];
ATS -> BSC [label="CTRL"];
ATS -> BSC [label="VTY"];
+ BSC -> ATS [label="StatsD"];
ATS -> BSC [label="A BSSAP\nSCCP/IPA"];
}
%}
diff --git a/bsc/gen_links.sh b/bsc/gen_links.sh
index 343cc1c..02e093d 100755
--- a/bsc/gen_links.sh
+++ b/bsc/gen_links.sh
@@ -70,6 +70,7 @@ DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn Osmocom_VTY_Functions.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp L3_Templates.ttcn BSSMAP_Templates.ttcn RAN_Emulation.ttcnpp RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn GSM_RR_Types.ttcn RSL_Types.ttcn RSL_Emulation.ttcn MGCP_Emulation.ttcn MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc BSSAP_CodecPort.ttcn RAN_Adapter.ttcnpp Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn RTP_CodecPort.ttcn RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc RTP_Emulation.ttcn IuUP_Types.ttcn IuUP_EncDec.cc IuUP_Emulation.ttcn SCCP_Templates.ttcn IPA_Testing.ttcn GSM_SystemInformation.ttcn GSM_RestOctets.ttcn "
FILES+="CBSP_Types.ttcn CBSP_Templates.ttcn "
FILES+="CBSP_CodecPort.ttcn CBSP_CodecPort_CtrlFunct.ttcn CBSP_CodecPort_CtrlFunctdef.cc CBSP_Adapter.ttcn "
+FILES+="StatsD_Types.ttcn StatsD_CodecPort.ttcn StatsD_CodecPort_CtrlFunct.ttcn StatsD_CodecPort_CtrlFunctdef.cc StatsD_Checker.ttcn"
gen_links $DIR $FILES
ignore_pp_results
diff --git a/bsc/osmo-bsc.cfg b/bsc/osmo-bsc.cfg
index cbadece..f8be2cd 100644
--- a/bsc/osmo-bsc.cfg
+++ b/bsc/osmo-bsc.cfg
@@ -41,7 +41,15 @@ log stderr
logging level lm3ua notice
logging level lmgcp notice
!
-stats interval 5
+stats interval 0
+stats reporter statsd
+ prefix TTCN3
+ level subscriber
+ remote-ip 127.0.0.1
+ remote-port 8125
+ flush-period 1
+ mtu 1024
+ enable
!
line vty
no login
diff --git a/bsc/regen_makefile.sh b/bsc/regen_makefile.sh
index def4a3f..f1ea963 100755
--- a/bsc/regen_makefile.sh
+++ b/bsc/regen_makefile.sh
@@ -2,7 +2,7 @@
MAIN=BSC_Tests.ttcn
-FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc SCTPasp_PT.cc RTP_EncDec.cc SDP_EncDec.cc RTP_CodecPort_CtrlFunctDef.cc MGCP_CodecPort_CtrlFunctDef.cc IuUP_EncDec.cc Native_FunctionDefs.cc TELNETasp_PT.cc CBSP_CodecPort_CtrlFunctdef.cc *.c"
+FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc SCTPasp_PT.cc RTP_EncDec.cc SDP_EncDec.cc RTP_CodecPort_CtrlFunctDef.cc MGCP_CodecPort_CtrlFunctDef.cc IuUP_EncDec.cc Native_FunctionDefs.cc TELNETasp_PT.cc CBSP_CodecPort_CtrlFunctdef.cc StatsD_CodecPort_CtrlFunctdef.cc *.c"
export CPPFLAGS_TTCN3="-DIPA_EMULATION_RSL -DIPA_EMULATION_MGCP -DIPA_EMULATION_CTRL -DIPA_EMULATION_SCCP -DRAN_EMULATION_BSSAP -DRAN_EMULATION_MGCP -DRAN_EMULATION_CTRL -DUSE_MTP3_DISTRIBUTOR"