pespin has uploaded this change for review.

View Change

asterisk: Delay test start until FullyBooted event is received in AMI

Change-Id: I65f56bcee332f4ae9ffc71ad7119c378ca1649dc
---
M asterisk/AMI_Functions.ttcn
M asterisk/Asterisk_Tests.ttcn
2 files changed, 45 insertions(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/70/36870/1
diff --git a/asterisk/AMI_Functions.ttcn b/asterisk/AMI_Functions.ttcn
index c05403e..714069f 100644
--- a/asterisk/AMI_Functions.ttcn
+++ b/asterisk/AMI_Functions.ttcn
@@ -173,6 +173,22 @@
tr_AMI_Field_ActionId(action_id)
);

+/*
+ * EVENTS
+ */
+template (present) AMI_Msg
+tr_AMI_Event(template (present) charstring ev_name := ?) := superset(
+ tr_AMI_Field_Event(ev_name)
+);
+
+/* Event: FullyBooted
+ * Privilege: system,all
+ * Status: Fully Booted
+ * Uptime: 4
+ * LastReload: 4 *
+ */
+template (present) AMI_Msg
+tr_AMI_Event_FullyBooted := tr_AMI_Event("FullyBooted");

/***********************
* Adapter:
@@ -420,6 +436,15 @@

}

+altstep as_ami_rx_ignore(AMI_Msg_PT pt)
+{
+ var AMI_Msg msg;
+ [] pt.receive(AMI_Msg:?) -> value msg {
+ log("Ignoring AMI message := ", msg);
+ repeat;
+ }
+}
+
private altstep as_ami_rx_fail(AMI_Msg_PT pt, template AMI_Msg exp_msg := *)
{
var AMI_Msg msg;
diff --git a/asterisk/Asterisk_Tests.ttcn b/asterisk/Asterisk_Tests.ttcn
index 8a124c1..a71bcad 100644
--- a/asterisk/Asterisk_Tests.ttcn
+++ b/asterisk/Asterisk_Tests.ttcn
@@ -100,8 +100,18 @@
};
vc_AMI.start(f_AMI_Adapter_main(ami_pars));

-
f_ami_action_login(AMI_CLIENT, mp_ami_user, mp_ami_secret);
+
+ timer tReady;
+ tReady.start(10.0);
+ alt {
+ [] AMI_CLIENT.receive(tr_AMI_Event_FullyBooted);
+ [] as_ami_rx_ignore(AMI_CLIENT);
+ [] tReady.timeout {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("AMI FullyBooted timeout: "));
+ }
+ }
}

/* Local SIP UAs */

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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I65f56bcee332f4ae9ffc71ad7119c378ca1649dc
Gerrit-Change-Number: 36870
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-MessageType: newchange