summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-03-30 13:50:02 +0200
committerHarald Welte <laforge@osmocom.org>2021-04-01 18:25:31 +0200
commit8396096c1c3d628a5a73ad718fa21031334e42c4 (patch)
treed1ebd5d58bf4d58845371ed1b4abbc0acc0a3273
parent94bbe9979626c2b7c081f15776ae3d3b43ac8c73 (diff)
CTRL_Adapter: Add function to obtain FSM instance state
This can be useful to verify expectations about the state of FSMs in the IUT. Change-Id: I33afc2e73be06e23147b5ac0b0fd3b9003935444
-rw-r--r--library/Osmocom_CTRL_Adapter.ttcn17
1 files changed, 17 insertions, 0 deletions
diff --git a/library/Osmocom_CTRL_Adapter.ttcn b/library/Osmocom_CTRL_Adapter.ttcn
index adc2887d..34ea300a 100644
--- a/library/Osmocom_CTRL_Adapter.ttcn
+++ b/library/Osmocom_CTRL_Adapter.ttcn
@@ -112,5 +112,22 @@ function f_ctrl_get_exp_trx(IPA_CTRL_PT pt, integer bts_nr, integer trx_nr, Ctrl
f_ctrl_get_exp(pt, valueof(ts_bts_trx(bts_nr, trx_nr)) & suffix, exp);
}
+template (value) charstring ts_fsm_inst_id(charstring class_name, charstring inst_id) :=
+ "fsm." & class_name & ".id." & inst_id & ".";
+
+/* obtain the state of a specified FSM instance */
+function f_ctrl_get_fsm_inst_state(IPA_CTRL_PT pt, charstring fsm_class_name, charstring fsm_inst_id)
+return charstring {
+ return f_ctrl_get(pt, valueof(ts_fsm_inst_id(fsm_class_name, fsm_inst_id)) & "state");
+}
+
+/* expect the state of a specified FSM instance to match template */
+function f_ctrl_get_exp_inst_state(IPA_CTRL_PT pt, charstring fsm_class_name,
+ template (value) charstring fsm_inst_id,
+ template (present) CtrlValue exp)
+{
+ f_ctrl_get_exp(pt, valueof(ts_fsm_inst_id(fsm_class_name, valueof(fsm_inst_id))) & "state", exp);
+}
+
}