fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31239 )


Change subject: library/GSM_Types: rework f_enc_BcdMccMnc: split and rename
......................................................................

library/GSM_Types: rework f_enc_BcdMccMnc: split and rename

* Rename f_enc_BcdMccMnc() -> f_enc_BcdMccMnc_int()
* Add f_enc_BcdMccMnc() accepting a pair of GsmMcc/GsmMnc

Change-Id: I033cce8f975f61ef2216de9f34f2ca418d71dc0b
Related: SYS#5602
---
M library/GSM_Types.ttcn
M pcu/PCU_Tests.ttcn
2 files changed, 18 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/39/31239/1

diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index e74972f..07da576 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -435,15 +435,24 @@
 type hexstring GsmBcdString with { variant "HEXORDER(low)" };
 type GsmBcdString BcdMccMnc with { variant "FIELDLENGTH(6)" };

+/* Compute BcdMccMnc from a pair of GsmMcc/GsmMnc values */
+function f_enc_BcdMccMnc(GsmMcc mcc, GsmMnc mnc) return BcdMccMnc {
+       if (lengthof(mnc) == 2) {
+               mnc := mnc[0] & mnc[1] & 'F'H;
+       }
+       return mcc[0] & mcc[1] & mnc[2] & mcc[2] & mnc[0] & mnc[1];
+}
+
 /* Compute BcdMccMnc from integer values */
-function f_enc_BcdMccMnc(uint16_t mcc, uint16_t mnc, boolean mnc_3_digits) 
return BcdMccMnc {
-       var hexstring mcc_str, mnc_str;
-       mcc_str := str2hex(int2str(mcc));
-       mnc_str := str2hex(int2str(mnc));
+function f_enc_BcdMccMnc_int(uint16_t mcc, uint16_t mnc, boolean mnc_3_digits) 
return BcdMccMnc {
+       var hexstring mcc_str := str2hex(int2str(mcc));
+       var hexstring mnc_str := str2hex(int2str(mnc));
        if (mnc_3_digits == true) {
-               return mcc_str[0] & mcc_str[1] & mnc_str[2] & mcc_str[2] & 
mnc_str[0] & mnc_str[1];
+               return f_enc_BcdMccMnc(mcc_str[0] & mcc_str[1] & mcc_str[2],
+                                      mnc_str[0] & mnc_str[1] & mnc_str[2]);
        } else {
-               return mcc_str[0] & mcc_str[1] & mcc_str[2] & 'F'H & mnc_str[0] 
& mnc_str[1];
+               return f_enc_BcdMccMnc(mcc_str[0] & mcc_str[1] & mcc_str[2],
+                                      mnc_str[0] & mnc_str[1]);
        }
 }

diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index 876b282..a537b96 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -5134,7 +5134,7 @@

 private function f_outbound_nacc_rim_tx_resp(PCUIF_info_ind info_ind)
 runs on RAW_PCU_Test_CT {
-       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1),
+       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc_int(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1),
                                                                    
info_ind.lac),
                                                             info_ind.rac),
                                                      info_ind.cell_id));
@@ -5159,7 +5159,7 @@
 altstep as_outbound_nacc_rim_resolve(PCUIF_info_ind info_ind, boolean 
do_answer := true, boolean do_repeat := false)
 runs on RAW_PCU_Test_CT {
        /* RIM procedure: */
-       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1),
+       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc_int(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1),
                                                                    
info_ind.lac),
                                                             info_ind.rac),
                                                      info_ind.cell_id));
@@ -5627,7 +5627,7 @@
        var GsmArfcn req_arfcn := 862;
        var uint6_t req_bsic := 43;
        var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != "";
-       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1), /* '262F42'H */
+       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc_int(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1), /* '262F42'H */
                                                                    
info_ind.lac),
                                                             info_ind.rac),
                                                      info_ind.cell_id));

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31239
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: I033cce8f975f61ef2216de9f34f2ca418d71dc0b
Gerrit-Change-Number: 31239
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to