sysinfo: Further simplification of code

This commit is contained in:
Harald Welte 2017-07-16 01:24:01 +02:00
parent 3927677343
commit fe1052d321
1 changed files with 59 additions and 33 deletions

View File

@ -479,18 +479,14 @@ module Test {
f_init();
/* Enable SI2bis + validate scheduling */
f_vty_enter_cfg_bts(BSCVTY, 0);
f_vty_si_static(BSCVTY, 0, "2bis", c_si2bis);
f_vty_si_resend(BSCVTY, 0);
f_vty_transceive(BSCVTY, "do write terminal");
si_cfg.si2bis_present := true;
f_si_cfg_to_vty();
si_per_tc := f_gsmtap_sample_si(GSMTAP);
f_validate_si_scheduling(si_cfg, si_per_tc);
/* cleanup */
f_vty_si_computed(BSCVTY, 0, "2bis");
f_vty_si_resend(BSCVTY, 0);
si_cfg.si2bis_present := false;
f_si_cfg_to_vty();
setverdict(pass);
}
@ -500,18 +496,14 @@ module Test {
f_init();
/* Enable SI2ter + validate scheduling */
f_vty_enter_cfg_bts(BSCVTY, 0);
f_vty_si_static(BSCVTY, 0, "2ter", c_si2ter);
f_vty_transceive(BSCVTY, "write terminal");
f_vty_si_resend(BSCVTY, 0);
si_cfg.si2ter_present := true;
f_si_cfg_to_vty();
si_per_tc := f_gsmtap_sample_si(GSMTAP);
f_validate_si_scheduling(si_cfg, si_per_tc);
/* cleanup */
f_vty_si_computed(BSCVTY, 0, "2ter");
f_vty_si_resend(BSCVTY, 0);
si_cfg.si2ter_present := false;
f_si_cfg_to_vty();
setverdict(pass);
}
@ -521,22 +513,16 @@ module Test {
f_init();
/* Enable SI2bis + SI2ter + validate scheduling */
f_vty_enter_cfg_bts(BSCVTY, 0);
f_vty_si_static(BSCVTY, 0, "2bis", c_si2bis);
f_vty_si_static(BSCVTY, 0, "2ter", c_si2ter);
f_vty_transceive(BSCVTY, "write terminal");
f_vty_si_resend(BSCVTY, 0);
si_cfg.si2bis_present := true;
si_cfg.si2ter_present := true;
f_si_cfg_to_vty();
si_per_tc := f_gsmtap_sample_si(GSMTAP);
f_validate_si_scheduling(si_cfg, si_per_tc);
/* cleanup */
f_vty_si_computed(BSCVTY, 0, "2bis");
f_vty_si_computed(BSCVTY, 0, "2ter");
f_vty_si_resend(BSCVTY, 0);
si_cfg.si2bis_present := false;
si_cfg.si2ter_present := false;
f_si_cfg_to_vty();
setverdict(pass);
}
@ -546,17 +532,12 @@ module Test {
f_init();
/* Enable SI2quater + validate scheduling */
f_vty_si2q_add_uarfcn(BSCVTY, 0, 23, 42);
f_vty_transceive(BSCVTY, "write terminal");
f_vty_si_resend(BSCVTY, 0);
si_cfg.si2quater_present := true;
si_per_tc := f_gsmtap_sample_si(GSMTAP);
f_validate_si_scheduling(si_cfg, si_per_tc);
f_si_cfg_to_vty();
/* cleanup */
f_vty_si2q_del_uarfcn(BSCVTY, 0, 23, 42);
f_vty_si_resend(BSCVTY, 0);
si_cfg.si2quater_present := false;
f_si_cfg_to_vty();
setverdict(pass);
}
@ -566,22 +547,66 @@ module Test {
f_init();
/* Enable SI2ter + validate scheduling */
f_vty_enter_cfg_bts(BSCVTY, 0);
f_vty_gprs_mode(BSCVTY, 0, "gprs");
f_vty_transceive(BSCVTY, "write terminal");
f_vty_si_resend(BSCVTY, 0);
si_cfg.si13_present := true;
f_si_cfg_to_vty();
si_per_tc := f_gsmtap_sample_si(GSMTAP);
f_validate_si_scheduling(si_cfg, si_per_tc);
/* cleanup */
f_vty_gprs_mode(BSCVTY, 0, "none");
f_vty_si_resend(BSCVTY, 0);
si_cfg.si13_present := false;
f_si_cfg_to_vty();
setverdict(pass);
}
testcase TC_si_sched_13_2bis_2ter_2quater() runs on dummy_CT {
var SystemInformationVectorPerTc si_per_tc;
f_init();
si_cfg.si2bis_present := true;
si_cfg.si2ter_present := true;
si_cfg.si2quater_present := true;
si_cfg.si13_present := true;
f_si_cfg_to_vty();
si_per_tc := f_gsmtap_sample_si(GSMTAP);
f_validate_si_scheduling(si_cfg, si_per_tc);
/* cleanup */
si_cfg.si2bis_present := false;
si_cfg.si2ter_present := false;
si_cfg.si2quater_present := false;
si_cfg.si13_present := false;
f_si_cfg_to_vty();
setverdict(pass);
}
function f_si_cfg_to_vty() runs on dummy_CT {
if (si_cfg.si2bis_present) {
f_vty_si_static(BSCVTY, 0, "2bis", c_si2bis);
} else {
f_vty_si_computed(BSCVTY, 0, "2bis");
}
if (si_cfg.si2ter_present) {
f_vty_si_static(BSCVTY, 0, "2ter", c_si2ter);
} else {
f_vty_si_computed(BSCVTY, 0, "2ter");
}
if (si_cfg.si13_present) {
f_vty_gprs_mode(BSCVTY, 0, "gprs");
} else {
f_vty_gprs_mode(BSCVTY, 0, "none");
}
if (si_cfg.si2quater_present) {
f_vty_si2q_add_uarfcn(BSCVTY, 0, 23, 42);
} else {
f_vty_si2q_del_uarfcn(BSCVTY, 0, 23, 42);
}
/* for debugging */
f_vty_transceive(BSCVTY, "write terminal");
/* actually commit the changes from BSC -> BTS */
f_vty_si_resend(BSCVTY, 0);
}
/* permitted prompts on VTY */
const charstring NORMAL_PROMPT := "OpenBSC> ";
@ -735,5 +760,6 @@ module Test {
execute(TC_si_sched_2ter_2bis());
execute(TC_si_sched_2quater());
execute(TC_si_sched_13());
execute(TC_si_sched_13_2bis_2ter_2quater());
}
}