neels submitted this change.

View Change


Approvals: fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified neels: Looks good to me, approved
Osmocom_CTRL: counters: return -1 for absent objects

Teach the CTRL functions that retrieve rate counters to return counters
of -1 when a requested object is not present, instead of erroring and
stopping the test. Like this we can expect absence of an object.

Upcoming patch Ibec009203d38f65714561b7c28edbdbd8b34e704 uses this.

Related: SYS#6773
Change-Id: Id00bbfe721d453e5f551e6d47e1b1d03d219700b
---
M library/Osmocom_CTRL_Functions.ttcn
1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/library/Osmocom_CTRL_Functions.ttcn b/library/Osmocom_CTRL_Functions.ttcn
index 75f8646..5202418 100644
--- a/library/Osmocom_CTRL_Functions.ttcn
+++ b/library/Osmocom_CTRL_Functions.ttcn
@@ -30,7 +30,7 @@
}

/* perform a given GET Operation */
- function f_ctrl_get(IPA_CTRL_PT pt, CtrlVariable variable) return CtrlValue {
+ function f_ctrl_get(IPA_CTRL_PT pt, CtrlVariable variable, template (omit) charstring on_err := omit) return CtrlValue {
timer T := 2.0;
var CtrlMessage rx;
var CtrlId id := f_gen_rand_id();
@@ -41,8 +41,12 @@
}
[] pt.receive(tr_CtrlMsgTrap) { repeat; }
[] pt.receive(tr_CtrlMsgError) -> value rx {
- setverdict(fail, "Error in CTRL GET ", variable, ": ", rx.err.reason);
- mtc.stop;
+ if (istemplatekind(on_err, "omit")) {
+ setverdict(fail, "Error in CTRL GET ", variable, ": ", rx.err.reason);
+ mtc.stop;
+ } else {
+ rx.resp.val := valueof(on_err);
+ }
}
[] T.timeout {
setverdict(fail, "Timeout waiting for CTRL GET REPLY ", variable);
@@ -155,7 +159,7 @@

function f_ctrl_get_ratectr_abs(IPA_CTRL_PT pt, CtrlVariable grp, integer instance,
CtrlVariable name) return integer {
- return str2int(f_ctrl_get(pt, valueof(ts_ctrl_ratectr(grp, instance, name))));
+ return str2int(f_ctrl_get(pt, valueof(ts_ctrl_ratectr(grp, instance, name)), on_err := "-1"));
}

function f_ctrl_get_exp_ratectr_abs(IPA_CTRL_PT pt, CtrlVariable grp, integer instance,

To view, visit change 37189. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Id00bbfe721d453e5f551e6d47e1b1d03d219700b
Gerrit-Change-Number: 37189
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-CC: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged