fixeria has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36611?usp=email )
Change subject: library/RSL_Emulation: make use of IpaUnitId codec
......................................................................
library/RSL_Emulation: make use of IpaUnitId codec
Change-Id: I20e1ac35707affc6aab60397a22e33fe2bd1106e
---
M library/RSL_Emulation.ttcn
1 file changed, 19 insertions(+), 20 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index 891e565..17e35ab 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -370,9 +370,7 @@
private function f_trx_conn_map_register(integer conn_id, in IpaCcmIdResp id_resp)
runs on RSL_Emulation_CT return IpaStreamId {
- var template charstring unit_id_fmt := pattern "(\d+)/(\d+)/(\d+)";
- var charstring unit_id;
- var integer trx_nr;
+ var IpaUnitId unit_id;
var integer idx;
/* Check if we have room for a new connection */
@@ -386,29 +384,21 @@
testcase.stop("IPA IDENTITY RESPONSE contains no unit-id");
}
- /* Make sure that IPA unit-id is valid */
- unit_id := oct2char(id_resp[idx].data);
- if (not match(unit_id, unit_id_fmt)) {
- testcase.stop("IPA unit-id has unknown/unexpected format");
- }
+ /* Parse IPA unit-id */
+ unit_id := dec_IpaUnitId(oct2char(id_resp[idx].data));
- /* Parse transceiver number (site/bts/trx).
- * TODO: implement and use declaratice types. */
- unit_id := regexp(unit_id, unit_id_fmt, 2);
- trx_nr := str2int(unit_id);
-
- if (trx_nr >= sizeof(TrxConnMap)) {
- testcase.stop("Transceiver #", trx_nr, " does not fit");
- } else if (TrxConnMap[trx_nr] != -1) {
- testcase.stop("Transceiver #", trx_nr, " is already
connected?!?");
+ if (unit_id.trx_id >= sizeof(TrxConnMap)) {
+ testcase.stop("Transceiver #", unit_id.trx_id, " does not fit");
+ } else if (TrxConnMap[unit_id.trx_id] != -1) {
+ testcase.stop("Transceiver #", unit_id.trx_id, " is already
connected?!?");
}
/* Finally, store the connection ID */
- log("Mapped TRX#", trx_nr, " to TCP/IP conn_id=", conn_id);
- TrxConnMap[trx_nr] := conn_id;
+ log("Mapped TRX#", unit_id.trx_id, " to TCP/IP conn_id=", conn_id);
+ TrxConnMap[unit_id.trx_id] := conn_id;
TrxConnNum := TrxConnNum + 1;
- return f_streamId_by_trx(trx_nr);
+ return f_streamId_by_trx(unit_id.trx_id);
}
private function f_trx_conn_map_unregister(integer conn_id)
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36611?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I20e1ac35707affc6aab60397a22e33fe2bd1106e
Gerrit-Change-Number: 36611
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged