pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40619?usp=email )
Change subject: StatsD_Checker: Keep polling IUT if waiting for convergence
......................................................................
StatsD_Checker: Keep polling IUT if waiting for convergence
The wait_converge feature was implemented and used so far only against
IUTs which used also the snapshot feature, due to not having a VTY which
allows both resetting and triggering a status report manually. Instead,
those relied on IUT reporting changes at a given frequency.
If the wait_converge feature is requested and polling mode is used, then
make sure we poll once per second after last received statsd UDP msg.
Change-Id: Id78b46b88048206f74d1d88672b8309227e9438c
---
M library/StatsD_Checker.ttcnpp
1 file changed, 31 insertions(+), 6 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
Jenkins Builder: Verified
lynxis lazus: Looks good to me, approved
diff --git a/library/StatsD_Checker.ttcnpp b/library/StatsD_Checker.ttcnpp
index a944176..081e6e1 100644
--- a/library/StatsD_Checker.ttcnpp
+++ b/library/StatsD_Checker.ttcnpp
@@ -298,6 +298,24 @@
return result;
}
+private function using_poll_mode()runs on StatsD_Checker_CT return boolean
+{
+#ifdef STATSD_HAVE_VTY
+ return true;
+#else
+ return false;
+#endif
+}
+
+private function poll_stats_report() runs on StatsD_Checker_CT
+{
+#ifdef STATSD_HAVE_VTY
+ f_vty_transceive(STATSVTY, "stats report");
+#else
+ /* Assume caller knows previous state, eg. gauges may have been 0 due to IUT being reset
*/
+#endif
+}
+
private function f_statsd_checker_expect(StatsDExpects expects,
boolean wait_converge := false,
boolean use_snapshot := false,
@@ -307,6 +325,8 @@
var StatsDExpectResult res;
var Booleans matched := {};
var integer matched_remain := 0;
+ var boolean poll := using_poll_mode();
+ timer T_poll_converge;
for (var integer i := 0; i < lengthof(expects); i := i + 1) {
matched := matched & {false};
@@ -316,12 +336,8 @@
/* Dismiss any messages we might have skipped from the last report */
STATS.clear;
- if (not use_snapshot) {
-#ifdef STATSD_HAVE_VTY
- f_vty_transceive(STATSVTY, "stats report");
-#else
- /* Assume caller knows previous state, eg. gauges may have been 0 due to IUT being
reset */
-#endif
+ if (poll) {
+ poll_stats_report();
}
T_statsd.start(g_timeout);
@@ -330,7 +346,15 @@
alt {
[] STATS.receive(tr_StatsD_RecvFrom(?, ?)) -> value rf {
msg := rf.msg;
+ if (poll and wait_converge) {
+ T_poll_converge.stop;
+ T_poll_converge.start(1.0);
}
+ }
+ [poll and wait_converge] T_poll_converge.timeout {
+ poll_stats_report();
+ repeat;
+ }
[] T_statsd.timeout {
for (var integer i := 0; i < lengthof(expects); i := i + 1) {
/* We're still missing some expects, keep looking */
@@ -369,6 +393,7 @@
}
}
}
+ T_poll_converge.stop;
T_statsd.stop;
return true;
}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40619?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Id78b46b88048206f74d1d88672b8309227e9438c
Gerrit-Change-Number: 40619
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>