gbproxy: Verify BVC FSM state during bring-up

This adds IUT fsm state instrospection via the CTRL interface.

docker-playground will need to set "mp_gbproxy_ip" in its configs.

Change-Id: I272e43b9be8ba53d8a815e8ab099c939f63413a7
This commit is contained in:
Harald Welte 2021-03-30 16:28:04 +02:00
parent 8396096c1c
commit b5688f26ed
2 changed files with 40 additions and 1 deletions

View File

@ -33,6 +33,7 @@ import from L3_Common all;
import from TELNETasp_PortType all;
import from Osmocom_VTY_Functions all;
import from Osmocom_CTRL_Adapter all;
import from LLC_Types all;
import from LLC_Templates all;
@ -46,6 +47,8 @@ const BcdMccMnc c_mcc_mnc := '262F42'H;
const integer max_fr_info_size := 1600;
modulepar {
charstring mp_gbproxy_ip := "127.0.0.1";
integer mp_gbproxy_ctrl_port := 4263;
/* NRI bit-length. 0 for no pooling */
integer mp_nri_bitlength := 5;
roro_integer mp_sgsn_nri := {
@ -330,7 +333,7 @@ type record of BssgpCellId BssgpCellIds;
* tests that use interleave on SGSN_MGMT.receive() for each SGSN NSEI for example */
const integer NUM_SGSN := 2;
type component test_CT {
type component test_CT extends CTRL_Adapter_CT {
var GbInstances g_pcu;
var GbInstances g_sgsn;
@ -516,6 +519,14 @@ runs on test_CT {
}
}
private template (value) charstring ts_pcu_bvc_fsm_id(uint16_t nsei, uint16_t bvci) :=
"NSE" & f_int2str(nsei, 5) & "-BVC" & f_int2str(bvci, 5);
function f_bvc_fsm_ensure_state(uint16_t nsei, uint16_t bvci, template (present) charstring exp)
runs on CTRL_Adapter_CT {
f_ctrl_get_exp_inst_state(IPA_CTRL, "BSSGP-BVC", ts_pcu_bvc_fsm_id(nsei, bvci), exp);
}
function f_init(float t_guard := 30.0) runs on test_CT {
var roro_integer bvci_unblocked;
var BssgpStatusIndication bsi;
@ -529,6 +540,8 @@ function f_init(float t_guard := 30.0) runs on test_CT {
g_Tguard.start(t_guard);
activate(as_gTguard(g_Tguard));
f_ipa_ctrl_start_client(mp_gbproxy_ip, mp_gbproxy_ctrl_port);
var BssgpBvcConfigs bvcs := { };
for (i := 0; i < lengthof(mp_gbconfigs); i := i+1) {
g_pcu[i].cfg := mp_gbconfigs[i];
@ -616,6 +629,25 @@ function f_init(float t_guard := 30.0) runs on test_CT {
}
}
/* verify all SGSN-side BVC FSM in IUT are UNBLOCKED */
for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) {
f_bvc_fsm_ensure_state(mp_nsconfig_sgsn[i].nsei, 0, "UNBLOCKED");
/* iterate over list and check all BVCI */
for (var integer j := 0; j < lengthof(g_sgsn[i].cfg.bvc); j := j+1) {
var BssgpBvci bvci := g_sgsn[i].cfg.bvc[j].bvci;
f_bvc_fsm_ensure_state(mp_nsconfig_sgsn[i].nsei, bvci, "UNBLOCKED");
}
}
/* verify all PCU-side BVC FSM in IUT are UNBLOCKED */
for (i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) {
f_bvc_fsm_ensure_state(mp_nsconfig_pcu[i].nsei, 0, "UNBLOCKED");
/* iterate over list and check all BVCI */
for (var integer j := 0; j < lengthof(g_pcu[i].cfg.bvc); j := j+1) {
var BssgpBvci bvci := g_pcu[i].cfg.bvc[j].bvci;
f_bvc_fsm_ensure_state(mp_nsconfig_pcu[i].nsei, bvci, "UNBLOCKED");
}
}
/* re-start guard timer after all BVCs are up, so it only counts the actual test case */
g_Tguard.start(t_guard);
}

View File

@ -51,6 +51,13 @@ type enumerated AddressFamily {
AF_INET6 ('0a'O)
}
/* like TTCN-3 int2str() but with padding of leading zeroes */
function f_int2str(integer i, integer total_digits) return charstring {
var charstring istr := int2str(i);
var charstring padstr := hex2str(int2hex(0, total_digits - lengthof(istr)));
return padstr & istr;
}
/* return random integer 0 <= ret < max. According to ETSI ES 201 873 C.6.1, rnd() returns *less* than 1, so
* the returned int will always be ret < max, or ret <= (max-1). */
function f_rnd_int(integer max) return integer {