From 535aea686e24c4be67e1cd16ce85ea75925859f5 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Mon, 21 Sep 2020 13:27:08 +0200 Subject: [PATCH] pcu: Check stats for pcu channel allocation, bytes transferred Change-Id: I90964b32fa11ed2582afc5fb56bd302b06606f86 Related: SYS#4877 --- pcu/PCU_Tests.default | 10 ++++++++++ pcu/PCU_Tests.ttcn | 43 ++++++++++++++++++++++++++++++++++++++++++- pcu/gen_links.sh | 1 + pcu/osmo-pcu.cfg | 10 ++++++++++ pcu/regen_makefile.sh | 2 +- 5 files changed, 64 insertions(+), 2 deletions(-) diff --git a/pcu/PCU_Tests.default b/pcu/PCU_Tests.default index db4bd58f6..fde1c79d3 100644 --- a/pcu/PCU_Tests.default +++ b/pcu/PCU_Tests.default @@ -23,6 +23,7 @@ SGSN_Components.mp_gb_cfg := { } Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoPCU"; PCUIF_Types.mp_pcuif_version := 10; +StatsD_Checker.mp_enable_stats := true; [TESTPORT_PARAMETERS] *.PCU.socket_type := "SEQPACKET" @@ -35,6 +36,15 @@ PCUIF_Types.mp_pcuif_version := 10; *.PCUVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes" *.PCUVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes" *.PCUVTY.PROMPT1 := "OsmoPCU> " +*.STATSVTY.CTRL_MODE := "client" +*.STATSVTY.CTRL_HOSTNAME := "127.0.0.1" +*.STATSVTY.CTRL_PORTNUM := "4240" +*.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 := "OsmoPCU> " [MAIN_CONTROLLER] diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn index 142cdcd4c..0bd70936c 100644 --- a/pcu/PCU_Tests.ttcn +++ b/pcu/PCU_Tests.ttcn @@ -51,10 +51,18 @@ import from Native_Functions all; import from SGSN_Components all; import from GPRS_Components all; +import from StatsD_Types all; +import from StatsD_CodecPort all; +import from StatsD_CodecPort_CtrlFunct all; +import from StatsD_Checker all; + modulepar { charstring mp_pcu_sock_path := PCU_SOCK_DEFAULT; float X2002 := 0.2; /* Timer -2002, IMM ASSIGN confirm delay */ + + charstring mp_pcu_statsd_ip := "127.0.0.1"; + integer mp_pcu_statsd_port := 8125; } @@ -102,10 +110,13 @@ type record lqual_range { uint8_t high } -type component RAW_PCU_Test_CT extends bssgp_CT, MS_BTS_IFACE_CT { +type component RAW_PCU_Test_CT extends bssgp_CT, MS_BTS_IFACE_CT, StatsD_ConnHdlr { /* PCU interface abstraction component */ var RAW_PCUIF_CT vc_PCUIF; + /* StatsD */ + var StatsD_Checker_CT vc_STATSD; + /* Connection to the PCUIF component */ port RAW_PCU_MSG_PT PCUIF; /* VTY connection to the PCU */ @@ -215,6 +226,11 @@ runs on RAW_PCU_Test_CT { f_init_vty(id); + f_init_statsd(id, vc_STATSD, mp_pcu_statsd_ip, mp_pcu_statsd_port); + /* This is normally done in the ConnHdlr component, but here + * the Test_CT doubles as ConnHdlr */ + connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + vc_PCUIF.start(f_PCUIF_CT_handler(mp_pcu_sock_path)); vc_BTS.start(f_BTS_CT_handler(0, valueof(info_ind))); @@ -1437,6 +1453,8 @@ testcase TC_dl_flow_more_blocks() runs on RAW_PCU_Test_CT { /* Initialize the PCU interface abstraction */ f_init_raw(testcasename()); + f_statsd_reset(); + /* Establish BSSGP connection to the PCU */ f_bssgp_establish(); f_bssgp_client_llgmm_assign('FFFFFFFF'O, ms.tlli); @@ -1486,6 +1504,17 @@ testcase TC_dl_flow_more_blocks() runs on RAW_PCU_Test_CT { /* Make sure that the next block (after the Ack) is dummy */ f_rx_rlcmac_dl_block_exp_dummy(dl_block); + var StatsDExpects expect := { + { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 0, max := 0}, + { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 1, max := 1}, + { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 0, max := 0}, + { name := "TTCN3.bts.0.tbf.dl.alloc", mtype := "c", min := 1, max := 1}, + { name := "TTCN3.bts.0.tbf.ul.alloc", mtype := "c", min := 0, max := 0}, + { name := "TTCN3.bts.0.rlc.dl_payload_bytes", mtype := "c", min := 112, max := 112}, + { name := "TTCN3.bts.0.rlc.ul_payload_bytes", mtype := "c", min := 0, max := 0} + }; + f_statsd_expect(expect); + f_shutdown(__BFILE__, __LINE__, final := true); } @@ -1849,6 +1878,8 @@ testcase TC_bssgp_dl_unitdata_with_valid_imsi() runs on RAW_PCU_Test_CT { /* Initialize the PCU interface abstraction */ f_init_raw(testcasename()); + f_statsd_reset(); + /* Establish BSSGP connection to the PCU */ f_bssgp_establish(); f_bssgp_client_llgmm_assign('FFFFFFFF'O, ms.tlli); @@ -1878,6 +1909,16 @@ testcase TC_bssgp_dl_unitdata_with_valid_imsi() runs on RAW_PCU_Test_CT { f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), f_dl_block_ack_fn(dl_block, dl_fn)); + var StatsDExpects expect := { + { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 1, max := 1}, + { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 1, max := 1}, + { name := "TTCN3.bts.0.tbf.dl.alloc", mtype := "c", min := 1, max := 1}, + { name := "TTCN3.bts.0.tbf.ul.alloc", mtype := "c", min := 1, max := 1}, + { name := "TTCN3.bts.0.rlc.dl_payload_bytes", mtype := "c", min := 28, max := 28}, + { name := "TTCN3.bts.0.rlc.ul_payload_bytes", mtype := "c", min := 16, max := 16} + }; + f_statsd_expect(expect); + f_shutdown(__BFILE__, __LINE__, final := true); } diff --git a/pcu/gen_links.sh b/pcu/gen_links.sh index 8b87e18b1..fbb79a00b 100755 --- a/pcu/gen_links.sh +++ b/pcu/gen_links.sh @@ -50,6 +50,7 @@ gen_links $DIR $FILES DIR=../library FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_VTY_Functions.ttcn Native_Functions.ttcn Native_FunctionDefs.cc GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn RLCMAC_Templates.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc " +FILES+="StatsD_Types.ttcn StatsD_CodecPort.ttcn StatsD_CodecPort_CtrlFunct.ttcn StatsD_CodecPort_CtrlFunctdef.cc StatsD_Checker.ttcn " FILES+="NS_Provider_IPL4.ttcn NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc " FILES+="BSSGP_Emulation.ttcnpp Osmocom_Gb_Types.ttcn " FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn " diff --git a/pcu/osmo-pcu.cfg b/pcu/osmo-pcu.cfg index d6213b51a..12dc577ed 100644 --- a/pcu/osmo-pcu.cfg +++ b/pcu/osmo-pcu.cfg @@ -9,6 +9,16 @@ log stderr logging print file basename last logging print extended-timestamp 1 logging level set-all debug +! +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/pcu/regen_makefile.sh b/pcu/regen_makefile.sh index b2063ac39..dc9b67282 100755 --- a/pcu/regen_makefile.sh +++ b/pcu/regen_makefile.sh @@ -1,6 +1,6 @@ #!/bin/sh -FILES="*.ttcn *.ttcnpp BSSGP_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc UD_PT.cc RLCMAC_EncDec.cc LLC_EncDec.cc TELNETasp_PT.cc Native_FunctionDefs.cc" +FILES="*.ttcn *.ttcnpp BSSGP_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc UD_PT.cc RLCMAC_EncDec.cc LLC_EncDec.cc TELNETasp_PT.cc Native_FunctionDefs.cc StatsD_CodecPort_CtrlFunctdef.cc" export CPPFLAGS_TTCN3="-DBSSGP_EM_L3"