sysinfo: Further simplification of code
diff --git a/sysinfo/Test.ttcn b/sysinfo/Test.ttcn
index 4e3186f..c30ad6a 100644
--- a/sysinfo/Test.ttcn
+++ b/sysinfo/Test.ttcn
@@ -479,18 +479,14 @@
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 @@
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 @@
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 @@
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 @@
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 @@
execute(TC_si_sched_2ter_2bis());
execute(TC_si_sched_2quater());
execute(TC_si_sched_13());
+ execute(TC_si_sched_13_2bis_2ter_2quater());
}
}