bts: Update towards most recent "laforge/trx" branch
The existing BTS testing code was based on a ~1 week old version
of trxcon+fake_trx from osmocom-bb.git fixeria/trx branch, which
has meanwhile evolved:
* port number change for TRX protocol
* FAKE_TIMING -> FAKE_TOA
* we can now expect responses to our UDP control commands
Let's adapt the testsuite to those changes
Change-Id: I6d0122202e5d23308421e76b75e608d206aab56e
diff --git a/library/TRXC_CodecPort.ttcn b/library/TRXC_CodecPort.ttcn
index 6acead0..774b674 100644
--- a/library/TRXC_CodecPort.ttcn
+++ b/library/TRXC_CodecPort.ttcn
@@ -13,8 +13,8 @@
TrxcMessage msg
}
-template TRXC_RecvFrom tr_TRXC_RecvFrom(template TrxcMessage msg) := {
- connId := ?,
+template TRXC_RecvFrom tr_TRXC_RecvFrom(template ConnectionId cid, template TrxcMessage msg) := {
+ connId := cid,
remName := ?,
remPort := ?,
locName := ?,
@@ -59,4 +59,31 @@
msg := msg
}
+function f_TRXC_transceive(TRXC_CODEC_PT pt, ConnectionId conn_id, TrxcMessage tx,
+ template TrxcMessage tr := ?) return TrxcMessage {
+ var TRXC_RecvFrom rf;
+ timer T := 3.0;
+ /* build better default template */
+ if (istemplatekind(tr, "?")) {
+ tr := {
+ rsp := {
+ verb := tx.cmd.verb,
+ status := ?,
+ params := *
+ }
+ };
+ }
+ pt.send(ts_TRXC_Send(conn_id, tx));
+ T.start;
+ alt {
+ [] pt.receive(tr_TRXC_RecvFrom(conn_id, tr)) -> value rf {
+ return rf.msg;
+ }
+ [] T.timeout {
+ setverdict(fail, "Timeout waiting for ", tr, " on ", pt);
+ }
+ }
+ return rf.msg;
+}
+
}