IPA_Emulation: Send ASP_IPA_EVENT_UP even in client mode
diff --git a/library/Osmocom_CTRL_Functions.ttcn b/library/Osmocom_CTRL_Functions.ttcn
new file mode 100644
index 0000000..8bd6025
--- /dev/null
+++ b/library/Osmocom_CTRL_Functions.ttcn
@@ -0,0 +1,60 @@
+module Osmocom_CTRL_Functions {
+ import from Osmocom_CTRL_Types all;
+ import from IPA_Emulation all;
+
+ private function f_gen_rand_id() return CtrlId {
+ return int2str(float2int(rnd()*999999999.0));
+ }
+
+ /* perform a given GET Operation */
+ function f_ctrl_get(IPA_CTRL_PT pt, CtrlVariable variable) return CtrlValue {
+ timer T := 2.0;
+ var CtrlMessage rx;
+ var CtrlId id := f_gen_rand_id();
+ pt.send(ts_CtrlMsgGet(id, variable));
+ T.start;
+ alt {
+ [] pt.receive(tr_CtrlMsgGetRepl(id, variable)) -> value rx { }
+ [] pt.receive(tr_CtrlMsgError) -> value rx {
+ setverdict(fail, "Error in CTRL GET ", variable, ": ", rx.err.reason);
+ }
+ [] T.timeout {
+ setverdict(fail, "Timeout waiting for CTRL GET REPLY ", variable);
+ }
+ }
+ return rx.resp.val;
+ }
+
+ /* perform a given SET Operation */
+ function f_ctrl_set(IPA_CTRL_PT pt, CtrlVariable variable, CtrlValue val) {
+ timer T := 2.0;
+ var CtrlMessage rx;
+ var CtrlId id := f_gen_rand_id();
+ pt.send(ts_CtrlMsgSet(id, variable, val));
+ T.start;
+ alt {
+ [] pt.receive(tr_CtrlMsgSetRepl(id, variable, val)) { }
+ [] pt.receive(tr_CtrlMsgError) -> value rx {
+ setverdict(fail, "Error in CTRL GET ", variable, ": ", rx.err.reason);
+ }
+ [] T.timeout {
+ setverdict(fail, "Timeout waiting for CTRL SET REPLY ", variable);
+ }
+ }
+ }
+
+ /* Expect a matching TRAP */
+ function f_ctrl_exp_trap(IPA_CTRL_PT pt, template CtrlVariable variable,
+ template CtrlValue val := ?) return CtrlValue {
+ timer T := 2.0;
+ var CtrlMessage rx;
+ T.start;
+ alt {
+ [] pt.receive(tr_CtrlMsgTrap(variable, val)) -> value rx {}
+ [] T.timeout {
+ setverdict(fail, "Timeout waiting for TRAP ", variable);
+ }
+ }
+ return rx.trap.val;
+ }
+}