diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2020-05-25 23:37:00 +0700 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2020-05-25 23:37:00 +0700 |
commit | e54102cc8dbb13a761cf222314e11e57ccaee085 (patch) | |
tree | c8d7ee7f626f59f4f958f25885347fbe5e799f11 | |
parent | efc9413afc0aa3a8cc19f14d29ffcc3441f0ef30 (diff) |
library/IPA_Types: WIP codec for IPA UnitID (site/bts/trx)fixeria/ipa_unit_id
Change-Id: I68eb0d9e28bbf5d2d8ffe916aae5a66a0fdb9bd0
-rw-r--r-- | library/IPA_Types.ttcn | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/library/IPA_Types.ttcn b/library/IPA_Types.ttcn index ce6f9b69..95ec7728 100644 --- a/library/IPA_Types.ttcn +++ b/library/IPA_Types.ttcn @@ -131,5 +131,45 @@ with { extension "prototype(convert)" extension "decode(RAW)" } +/* Example: 1234/0/1 (site 1234, BTS#0, TRX#0) */ +type record IpaUnitId { + integer site_id, + integer bts_id, + integer trx_id +} with { + encode "TEXT" + variant "SEPARATOR('/', '/')" +}; + +external function enc_IpaUnitId(in IpaUnitId unit_id) return charstring + with { extension "prototype(convert) encode(TEXT)" } +external function dec_IpaUnitId(in charstring stream) return IpaUnitId + with { extension "prototype(convert) decode(TEXT)" } + +template (value) IpaUnitId ts_IpaUnitId(integer site_id := 1234, + integer bts_id := 0, + integer trx_id := 0) := { + site_id := site_id, + bts_id := bts_id, + trx_id := trx_id +}; +template IpaUnitId tr_IpaUnitId(template (present) integer site_id := ?, + template (present) integer bts_id := ?, + template (present) integer trx_id := ?) := { + site_id := site_id, + bts_id := bts_id, + trx_id := trx_id +}; + +private type component Dummy_CT { }; + +testcase TC_selftest_IpaUnitId() runs on Dummy_CT { + var IpaUnitId unit_id := valueof(ts_IpaUnitId(1234, 0, 3)); + var charstring unit_id_enc := enc_IpaUnitId(unit_id); + + log("Enc: ", unit_id_enc); + log("Dec: ", dec_IpaUnitId(unit_id_enc & "\00")); +} + } with { encode "RAW" } |