pcu: Add VTY support and use it to set (M)CS lqual thresholds

Requires osmo-pcu.git I3430abb5fc622dec293457466e760de95fa3a05c, before
that commit OsmoPCU cmd prompt contained a dash which resulted in TTCN3
being unable to match it.

Change-Id: I221675721b65b3ab44179e9657da70ba4004d7de
This commit is contained in:
Pau Espin 2019-11-29 12:48:16 +01:00 committed by pespin
parent af7c318489
commit 2a45a5037d
4 changed files with 91 additions and 2 deletions

View File

@ -21,10 +21,20 @@ PCU_Tests.mp_gb_cfg := {
},
sgsn_role := true
}
Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoPCU";
[TESTPORT_PARAMETERS]
*.*.udpReuseAddress := "yes";
*.PCU.socket_type := "SEQPACKET"
*.PCUVTY.CTRL_MODE := "client"
*.PCUVTY.CTRL_HOSTNAME := "127.0.0.1"
*.PCUVTY.CTRL_PORTNUM := "4240"
*.PCUVTY.CTRL_LOGIN_SKIPPED := "yes"
*.PCUVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
*.PCUVTY.CTRL_READMODE := "buffered"
*.PCUVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
*.PCUVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
*.PCUVTY.PROMPT1 := "OsmoPCU> "
[MAIN_CONTROLLER]

View File

@ -21,6 +21,9 @@ import from Osmocom_Types all;
import from GSM_Types all;
import from GSM_RR_Types all;
import from Osmocom_VTY_Functions all;
import from TELNETasp_PortType all;
import from RLCMAC_CSN1_Types all;
import from RLCMAC_Types all;
@ -456,11 +459,42 @@ testcase TC_ns_so_block() runs on RAW_Test_CT {
setverdict(pass);
}
type record lqual_range {
/* component reference to the IPA_Client component used for RSL */
uint8_t low,
uint8_t high
}
type component RAW_PCU_Test_CT extends bssgp_CT {
/* Connection to the BTS component (one for now) */
port RAW_PCU_MSG_PT BTS;
/* Connection to the PCUIF component */
port RAW_PCU_MSG_PT PCUIF;
/* VTY connection to the PCU */
port TELNETasp_PT PCUVTY;
/* Uplink CS/MCS thresholds, default from pcu_main.c: */
var lqual_range g_cs_lqual_ranges[4] := {{low := 0, high := 6},
{low := 5, high := 8},
{low := 7, high := 13},
{low := 12,high := 35}};
var lqual_range g_mcs_lqual_ranges[9] := {{low := 0, high := 6},
{low := 5, high := 8},
{low := 7, high := 13},
{low := 12,high := 15},
{low := 14, high := 17},
{low := 16, high := 18},
{low := 17,high := 20},
{low := 19, high := 24},
{low := 23,high := 35}};
var uint8_t g_cs_initial_dl := 1;
var uint8_t g_cs_initial_ul := 1;
var uint8_t g_mcs_initial_dl := 1;
var uint8_t g_mcs_initial_ul := 1;
var uint8_t g_cs_max_dl := 4;
var uint8_t g_cs_max_ul := 4;
var uint8_t g_mcs_max_dl := 9;
var uint8_t g_mcs_max_ul := 9;
/* Guard timeout */
timer g_T_guard := 60.0;
@ -473,6 +507,43 @@ private altstep as_Tguard_RAW() runs on RAW_PCU_Test_CT {
}
}
private function f_pcuvty_set_allowed_cs_mcs() runs on RAW_PCU_Test_CT {
f_vty_config2(PCUVTY, {"pcu"}, "cs " & int2str(g_cs_initial_dl) & " " & int2str(g_cs_initial_ul));
f_vty_config2(PCUVTY, {"pcu"}, "cs max " & int2str(g_cs_max_dl) & " " & int2str(g_cs_max_ul));
f_vty_config2(PCUVTY, {"pcu"}, "mcs " & int2str(g_mcs_initial_dl) & " " & int2str(g_mcs_initial_ul));
f_vty_config2(PCUVTY, {"pcu"}, "mcs max " & int2str(g_mcs_max_dl) & " " & int2str(g_mcs_max_ul));
}
private function f_pcuvty_set_link_quality_ranges() runs on RAW_PCU_Test_CT {
var charstring cmd;
cmd := "cs link-quality-ranges" &
" cs1 " & int2str(g_cs_lqual_ranges[0].high) &
" cs2 " & int2str(g_cs_lqual_ranges[1].low) & " " & int2str(g_cs_lqual_ranges[1].high) &
" cs3 " & int2str(g_cs_lqual_ranges[2].low) & " " & int2str(g_cs_lqual_ranges[2].high) &
" cs4 " & int2str(g_cs_lqual_ranges[3].low);
f_vty_config2(PCUVTY, {"pcu"}, cmd);
cmd := "mcs link-quality-ranges" &
" mcs1 " & int2str(g_mcs_lqual_ranges[0].high) &
" mcs2 " & int2str(g_mcs_lqual_ranges[1].low) & " " & int2str(g_mcs_lqual_ranges[1].high) &
" mcs3 " & int2str(g_mcs_lqual_ranges[2].low) & " " & int2str(g_mcs_lqual_ranges[2].high) &
" mcs4 " & int2str(g_mcs_lqual_ranges[3].low) & " " & int2str(g_mcs_lqual_ranges[3].high) &
" mcs5 " & int2str(g_mcs_lqual_ranges[4].low) & " " & int2str(g_mcs_lqual_ranges[4].high) &
" mcs6 " & int2str(g_mcs_lqual_ranges[5].low) & " " & int2str(g_mcs_lqual_ranges[5].high) &
" mcs7 " & int2str(g_mcs_lqual_ranges[6].low) & " " & int2str(g_mcs_lqual_ranges[6].high) &
" mcs8 " & int2str(g_mcs_lqual_ranges[7].low) & " " & int2str(g_mcs_lqual_ranges[7].high) &
" mcs9 " & int2str(g_mcs_lqual_ranges[8].low);
f_vty_config2(PCUVTY, {"pcu"}, cmd);
}
private function f_init_vty(charstring id) runs on RAW_PCU_Test_CT {
map(self:PCUVTY, system:PCUVTY);
f_vty_set_prompts(PCUVTY);
f_vty_transceive(PCUVTY, "enable");
}
private function f_init_raw(charstring id, template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default)
runs on RAW_PCU_Test_CT {
var RAW_PCUIF_CT vc_PCUIF;
@ -492,6 +563,8 @@ runs on RAW_PCU_Test_CT {
connect(vc_BTS:PCUIF, vc_PCUIF:BTS);
connect(vc_BTS:TC, self:BTS);
f_init_vty(id);
vc_PCUIF.start(f_PCUIF_CT_handler(mp_pcu_sock_path));
vc_BTS.start(f_BTS_CT_handler(0, valueof(info_ind)));
@ -967,6 +1040,9 @@ testcase TC_cs_lqual_ul_tbf() runs on RAW_PCU_Test_CT {
/* Initialize the PCU interface abstraction */
f_init_raw(testcasename());
f_pcuvty_set_allowed_cs_mcs();
f_pcuvty_set_link_quality_ranges();
/* Establish an Uplink TBF */
ok := f_establish_tbf(rr_imm_ass);
if (not ok) {

View File

@ -44,9 +44,12 @@ DIR=$BASEDIR/titan.ProtocolModules.SNDCP_v7.0.0/src
FILES="SNDCP_Types.ttcn"
gen_links $DIR $FILES
DIR=$BASEDIR/titan.TestPorts.TELNETasp/src
FILES="TELNETasp_PT.cc TELNETasp_PT.hh TELNETasp_PortType.ttcn"
gen_links $DIR $FILES
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
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_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "

View File

@ -1,5 +1,5 @@
#!/bin/sh
FILES="*.ttcn 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 L1CTL_PortType_CtrlFunctDef.cc Native_FunctionDefs.cc"
FILES="*.ttcn 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 L1CTL_PortType_CtrlFunctDef.cc TELNETasp_PT.cc Native_FunctionDefs.cc"
../regen-makefile.sh PCU_Tests.ttcn $FILES