[S] Change in osmo-ttcn3-hacks[master]: StatsD_Checker: Keep polling IUT if waiting for convergence
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/19/40619/1 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: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Id78b46b88048206f74d1d88672b8309227e9438c Gerrit-Change-Number: 40619 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de>
participants (1)
-
pespin