This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14409 Change subject: lib/CTRL: Add more helper templates and functions ...................................................................... lib/CTRL: Add more helper templates and functions Change-Id: Icc6ac860ebd6a719f9e0cb5c5345fb4d39a864ce --- M library/Osmocom_CTRL_Functions.ttcn M library/Osmocom_CTRL_Types.ttcn 2 files changed, 69 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/09/14409/1 diff --git a/library/Osmocom_CTRL_Functions.ttcn b/library/Osmocom_CTRL_Functions.ttcn index 94dcb8a..23fbc30 100644 --- a/library/Osmocom_CTRL_Functions.ttcn +++ b/library/Osmocom_CTRL_Functions.ttcn @@ -71,6 +71,11 @@ } } + /* send a TRAP */ + function f_ctrl_trap(IPA_CTRL_PT pt, CtrlVariable variable, CtrlValue val) { + pt.send(ts_CtrlMsgTrap(variable, val)); + } + /* Expect a matching TRAP */ function f_ctrl_exp_trap(IPA_CTRL_PT pt, template CtrlVariable variable, template CtrlValue val := ?) return CtrlValue { @@ -88,6 +93,26 @@ return rx.trap.val; } + /* Expect a matching SET, optionally answer */ + function f_ctrl_exp_set(IPA_CTRL_PT pt, template CtrlVariable variable, + template CtrlValue val := ?, template (omit) CtrlValue rsp := omit) return CtrlValue { + timer T := 2.0; + var CtrlMessage rx; + T.start; + alt { + [] pt.receive(tr_CtrlMsgSet(variable, val)) -> value rx { + if (ispresent(rsp)) { + pt.send(ts_CtrlMsgSet(rx.cmd.id, valueof(variable), valueof(rsp))); + } + } + [] T.timeout { + setverdict(fail, "Timeout waiting for SET ", variable); + mtc.stop; + } + } + return rx.cmd.val; + } + /* Expect a matching GET result */ function f_ctrl_get_exp(IPA_CTRL_PT pt, CtrlVariable variable, template CtrlValue exp) { var charstring ctrl_resp; diff --git a/library/Osmocom_CTRL_Types.ttcn b/library/Osmocom_CTRL_Types.ttcn index 5c4527e..52be956 100644 --- a/library/Osmocom_CTRL_Types.ttcn +++ b/library/Osmocom_CTRL_Types.ttcn @@ -94,6 +94,50 @@ } } +template CtrlMessage ts_CtrlMsgTrap(CtrlVariable variable, template (omit) CtrlValue val := omit) := { + trap := { + variable := variable, + val := val + } +} + +template CtrlMessage ts_CtrlMsgGetRepl(CtrlId id, CtrlVariable variable, CtrlValue val) := { + resp := { + verb := "GET_REPLY", + id := id, + variable := variable, + val := val + } +}; + +template CtrlMessage ts_CtrlMsgSetRepl(CtrlId id, CtrlVariable variable, CtrlValue val) := { + resp := { + verb := "SET_REPLY", + id := id, + variable := variable, + val := val + } +} + +template CtrlMessage tr_CtrlMsgGet(template CtrlId id, template CtrlVariable variable := ?) := { + cmd := { + verb := "GET", + id := id, + variable := variable, + val := ? + } +} + +template CtrlMessage tr_CtrlMsgSet(template CtrlId id, template CtrlVariable variable := ?, + template CtrlValue val := ?) := { + cmd := { + verb := "SET", + id := id, + variable := variable, + val := val + } +} + template CtrlMessage tr_CtrlMsgGetRepl(template CtrlId id, template CtrlVariable variable := ?) := { resp := { verb := "GET_REPLY", -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14409 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Icc6ac860ebd6a719f9e0cb5c5345fb4d39a864ce Gerrit-Change-Number: 14409 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190610/d536e40a/attachment.htm>