pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40635?usp=email )

Change subject: msc: Add suport to obtain statsd output
......................................................................

msc: Add suport to obtain statsd output

It will be used in a follow-up commit introducing a new test.

Change-Id: I66ffb278a7ddff975e43f72d9ec6b323705f720c
---
M msc/MSC_Tests.default
M msc/MSC_Tests.ttcn
M msc/README.md
M msc/gen_links.sh
M msc/osmo-msc.cfg
M msc/regen_makefile.sh
6 files changed, 42 insertions(+), 2 deletions(-)

Approvals:
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve




diff --git a/msc/MSC_Tests.default b/msc/MSC_Tests.default
index 98bf299..34954bd 100644
--- a/msc/MSC_Tests.default
+++ b/msc/MSC_Tests.default
@@ -22,6 +22,15 @@
 *.MSCVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
 *.MSCVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
 *.MSCVTY.PROMPT1 := "OsmoMSC> "
+*.STATSVTY.CTRL_MODE := "client"
+*.STATSVTY.CTRL_HOSTNAME := "127.0.0.1"
+*.STATSVTY.CTRL_PORTNUM := "4254"
+*.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 := "OsmoMSC> "


 [MODULE_PARAMETERS]
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 22b6608..1ba52d9 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -78,6 +78,11 @@

 import from SCCP_Templates all;

+import from StatsD_Types all;
+import from StatsD_CodecPort all;
+import from StatsD_CodecPort_CtrlFunct all;
+import from StatsD_Checker all;
+
 import from SS_Types all;
 import from SS_Templates all;
 import from USSD_Helpers all;
@@ -90,7 +95,7 @@
 /* Needed for SGsAP SMS */
 import from MobileL3_SMS_Types all;

-type component MTC_CT extends CTRL_Adapter_CT {
+type component MTC_CT extends CTRL_Adapter_CT, StatsD_ConnHdlr {
        var boolean g_initialized := false;

        var RAN_Adapter g_bssap[NUM_BSC];
@@ -108,6 +113,10 @@
        /* VTY to MSC */
        port TELNETasp_PT MSCVTY;

+       /* StatsD */
+       var StatsD_Checker_CT vc_STATSD;
+       var float g_statd_timeout := 5.0;
+
        /* A port to directly send BSSAP messages. This port is used for
         * tests that require low level access to sen arbitrary BSSAP
         * messages. Run f_init_bssap_direct() to connect and initialize */
@@ -129,6 +138,8 @@
        charstring mp_msc_ip := "127.0.0.1";
        integer mp_msc_ctrl_port := 4255;
        integer mp_msc_vty_port := 4254;
+       /* port number to which to listen for STATSD metrics */
+       integer mp_msc_statsd_port := 8125;

        /* local parameters of emulated HLR */
        boolean mp_mm_info := false;
@@ -137,6 +148,11 @@
        charstring mp_mgw_ip := "127.0.0.1";
        integer mp_mgw_port := 2427;

+       /* Address where we listen for STATSD metrics */
+       charstring mp_local_statsd_ip := "127.0.0.1";
+       charstring mp_statsd_prefix := "TTCN3.";
+
+
        charstring mp_msc_mncc := "/tmp/mncc";

        integer mp_msc_smpp_port := 2775;
@@ -357,6 +373,8 @@
                f_init_sgsap("MSC_Test");
        }

+       f_init_statsd("MSC_Test", vc_STATSD, mp_local_statsd_ip, 
mp_msc_statsd_port, g_statd_timeout);
+
 }

 /* Initialize for a direct connection to BSSAP. This function is an alternative
diff --git a/msc/README.md b/msc/README.md
index d79303b..d411b0c 100644
--- a/msc/README.md
+++ b/msc/README.md
@@ -9,6 +9,7 @@
     * SMPP (emulates ESME side)
     * VTY
     * CTRL
+    * StatsD

 {% dot msc_tests.svg
 digraph G {
@@ -21,6 +22,7 @@
   ATS -> MSC [label="SMPP",style="dashed"];
   ATS -> MSC [label="CTRL"];
   ATS -> MSC [label="VTY"];
+  MSC -> ATS [label="StatsD"];
   MSC -> ATS [label="GSUP"];
   MSC -> ATS [label="MGCP"];
   ATS -> STP [label="A BSSAP\nSCCP/M3UA"];
diff --git a/msc/gen_links.sh b/msc/gen_links.sh
index 63d90fc..f18c2f8 100755
--- a/msc/gen_links.sh
+++ b/msc/gen_links.sh
@@ -103,6 +103,7 @@
 FILES+="SS_Templates.ttcn SCCP_Templates.ttcn USSD_Helpers.ttcn "
 FILES+="SGsAP_Templates.ttcn SGsAP_CodecPort.ttcn 
SGsAP_CodecPort_CtrlFunct.ttcn SGsAP_CodecPort_CtrlFunctDef.cc 
SGsAP_Emulation.ttcn DNS_Helpers.ttcn "
 FILES+="SCTP_Templates.ttcn "
+FILES+="StatsD_Types.ttcn StatsD_CodecPort.ttcn 
StatsD_CodecPort_CtrlFunct.ttcn StatsD_CodecPort_CtrlFunctdef.cc 
StatsD_Checker.ttcnpp "
 gen_links $DIR $FILES

 gen_links_finish
diff --git a/msc/osmo-msc.cfg b/msc/osmo-msc.cfg
index 61b03cf..9b52896 100644
--- a/msc/osmo-msc.cfg
+++ b/msc/osmo-msc.cfg
@@ -34,7 +34,15 @@
  logging level vlr debug
  logging level iucs debug
 !
-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/msc/regen_makefile.sh b/msc/regen_makefile.sh
index b254f9d..7f897a5 100755
--- a/msc/regen_makefile.sh
+++ b/msc/regen_makefile.sh
@@ -23,6 +23,7 @@
        SGsAP_CodecPort_CtrlFunctDef.cc
        SMPP_CodecPort_CtrlFunctDef.cc
        SMPP_EncDec.cc
+       StatsD_CodecPort_CtrlFunctdef.cc
        SS_EncDec.cc
        TCCConversion.cc
        TCCEncoding.cc
@@ -41,6 +42,7 @@
        -DRAN_EMULATION_CTRL
        -DRAN_EMULATION_MGCP
        -DRAN_EMULATION_RANAP
+       -DSTATSD_HAVE_VTY
        -DUSE_MTP3_DISTRIBUTOR
 "


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40635?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I66ffb278a7ddff975e43f72d9ec6b323705f720c
Gerrit-Change-Number: 40635
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to