pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40112?usp=email )
Change subject: Move f_{dec,enc}_mcc_mnc() API BSSMAP_Templates.ttcn -> GSM_Types.ttcn ......................................................................
Move f_{dec,enc}_mcc_mnc() API BSSMAP_Templates.ttcn -> GSM_Types.ttcn
The GsmMcc and GsmMnc types used in the function are defined in GSM_Types.ttcn, which is also incldued by BSSMAP_Templates. Hence, move the function there so that it can be used in other testsuites including more generic GSM_Types.ttcn but not BSSMAP_Templates.ttcn.
Change-Id: Iafafd2957a11d34a9402d252a169fec40593f483 --- M cbc/CBC_Tests.ttcn M library/BSSMAP_Templates.ttcn M library/GSM_Types.ttcn 3 files changed, 18 insertions(+), 18 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/cbc/CBC_Tests.ttcn b/cbc/CBC_Tests.ttcn index 52f6378..a00b5d1 100644 --- a/cbc/CBC_Tests.ttcn +++ b/cbc/CBC_Tests.ttcn @@ -3,6 +3,7 @@ import from Osmocom_Types all; import from Socket_API_Definitions all;
+import from GSM_Types all; import from BSSAP_Types all; import from BSSMAP_Templates all; import from CBSP_Types all; diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn index a93fb02..563d6d1 100644 --- a/library/BSSMAP_Templates.ttcn +++ b/library/BSSMAP_Templates.ttcn @@ -1450,24 +1450,6 @@ cIl_LAC := lacl }
- -function f_enc_mcc_mnc(GsmMcc mcc, GsmMnc mnc) return OCT3 { - if (lengthof(mnc) == 2) { - return hex2oct(mcc[1] & mcc[0] & 'F'H & mcc[2] & mnc[1] & mnc[0]); - } else { - return hex2oct(mcc[1] & mcc[0] & mnc[2] & mcc[2] & mnc[1] & mnc[0]); - } -} - -function f_dec_mcc_mnc(in OCT3 mcc_mnc, out GsmMcc mcc, out GsmMnc mnc) { - var hexstring hs := oct2hex(mcc_mnc); - mcc := hs[1] & hs[0] & hs[3]; - mnc := hs[5] & hs[4]; - if (hs[2] == 'F'H) { - mnc := mnc & hs[2]; - } -} - template (value) BSSMAP_FIELD_CellIdentification_CGI ts_BSSMAP_CI_CGI(GsmMcc mcc, GsmMnc mnc, GsmLac lac, GsmCellId ci) := { mcc_mnc := f_enc_mcc_mnc(mcc, mnc), lac := int2oct(lac, 2), diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn index 54c2e98..64581e5 100644 --- a/library/GSM_Types.ttcn +++ b/library/GSM_Types.ttcn @@ -492,6 +492,23 @@ setverdict(pass); }
+function f_enc_mcc_mnc(GsmMcc mcc, GsmMnc mnc) return OCT3 { + if (lengthof(mnc) == 2) { + return hex2oct(mcc[1] & mcc[0] & 'F'H & mcc[2] & mnc[1] & mnc[0]); + } else { + return hex2oct(mcc[1] & mcc[0] & mnc[2] & mcc[2] & mnc[1] & mnc[0]); + } +} + +function f_dec_mcc_mnc(in OCT3 mcc_mnc, out GsmMcc mcc, out GsmMnc mnc) { + var hexstring hs := oct2hex(mcc_mnc); + mcc := hs[1] & hs[0] & hs[3]; + mnc := hs[5] & hs[4]; + if (hs[2] == 'F'H) { + mnc := mnc & hs[2]; + } +} + /* 24.008 10.5.1.3 */ type record LocationAreaIdentification { BcdMccMnc mcc_mnc,