[PATCH] osmo-ttcn3-hacks[master]: bts: Type Definition + Template for SI3; Send SI3 at start o...

2018-02-25 Thread Harald Welte
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/6885

to look at the new patch set (#2).

bts: Type Definition + Template for SI3; Send SI3 at start of test

The BTS needs some of the SI3 parameters like BS_AG_BLKS_RES for
internal computations, so make sure we send it after the connection
has been established.

Change-Id: I5dc3724f79e669f52593cd776806d84b4dd4bf5c
---
M bts/BTS_Tests.ttcn
M library/GSM_RR_Types.ttcn
M library/General_Types.ttcn
M library/L3_Templates.ttcn
4 files changed, 142 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/85/6885/2

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 58c7118..287d869 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -12,6 +12,7 @@
 import from Osmocom_CTRL_Adapter all;
 
 import from RSL_Types all;
+import from IPA_Types all;
 import from IPA_Emulation all;
 import from RSL_Emulation all;
 
@@ -19,6 +20,9 @@
 import from TRXC_Types all;
 import from TRXC_CodecPort all;
 import from TRXC_CodecPort_CtrlFunct all;
+
+import from L3_Templates all;
+import from MobileL3_CommonIE_Types all;
 
 /* The tests assume a BTS with the following timeslot configuration:
  * TS0 : Combined CCCH + SDCCH/4
@@ -75,11 +79,62 @@
ConnL1Pars l1_pars
 }
 
+/* Default SYSTEM INFORMATION 3 */
+template (value) GsmRrMessage ts_SI3_default := {
+   header := t_RrHeader(SYSTEM_INFORMATION_TYPE_3, 0),
+   payload := {
+   si3 := {
+   cell_id := 23,
+   lai := {
+   mcc_mnc := '262F42'H,
+   lac := 42
+   },
+   ctrl_chan_desc := {
+   msc_r99 := true,
+   att := true,
+   bs_ag_blks_res := 1,
+   ccch_conf := CCHAN_DESC_1CCCH_COMBINED,
+   si22_ind := false,
+   cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED,
+   spare := '00'B,
+   bs_pa_mfrms := 0, /* 2 multiframes */
+   t3212 := 1 /* 6 minutes */
+   },
+   cell_opts := {
+   dn_ind := false,
+   pwrc := false,
+   dtx := MS_MAY_USE_UL_DTX,
+   radio_link_tout_div4 := 4/4
+   },
+   cell_sel_pars := {
+   cell_resel_hyst_2dB := 0,
+   ms_txpwr_max_cch := 0,
+   acs := '0'B,
+   neci := true,
+   rxlev_access_min := 0
+   },
+   rach_ctrl_pars := {
+   max_retrans := RACH_MAX_RETRANS_1,
+   tx_integer := ''B, /* 3 slots */
+   cell_bar_access := false,
+   re_not_allowed := true,
+   acc := ''B
+   },
+   rest_octets := ''O
+   }
+   }
+}
 
 /* global init function */
 function f_init(charstring id) runs on test_CT {
f_init_rsl(id);
RSL_CCHAN.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP});
+
+   /* Send SI3 to the BTS, it is needed for various computations */
+   var GsmRrMessage si3 := valueof(ts_SI3_default);
+   log("Sending SI3 ", si3);
+   var octetstring si3_enc := enc_GsmRrMessage(si3);
+   RSL_CCHAN.send(ts_RSL_UD(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_3, si3_enc)));
 }
 
 type function void_fn(charstring id) runs on ConnHdlr;
@@ -99,6 +154,17 @@
return vc_conn;
 }
 
+template ASP_RSL_Unitdata ts_RSL_UD(template RSL_Message rsl, IpaStreamId sid 
:= IPAC_PROTO_RSL_TRX0) := {
+   streamId := sid,
+   rsl := rsl
+}
+
+template ASP_RSL_Unitdata tr_RSL_UD(template RSL_Message rsl,
+   template IpaStreamId sid := 
IPAC_PROTO_RSL_TRX0) := {
+   streamId := sid,
+   rsl := rsl
+}
+
 private altstep as_Tguard() runs on ConnHdlr {
[] g_Tguard.timeout {
setverdict(fail, "Tguard timeout");
diff --git a/library/GSM_RR_Types.ttcn b/library/GSM_RR_Types.ttcn
index 4d1efd7..a8b6db2 100644
--- a/library/GSM_RR_Types.ttcn
+++ b/library/GSM_RR_Types.ttcn
@@ -366,6 +366,68 @@
uint3_t non_drx_timer
} with { variant "" };
 
+   /* 44.018 10.5.2.3 */
+   type enumerated CellOptions_DTX {
+   MS_MAY_USE_UL_DTX   ('00'B),
+   MS_SHALL_USE_UL_DTX ('01'B),
+   MS_SHALL_NOT_USE_UL_DTX ('10'B)
+   } with { variant "FIELDLENGTH(2)" };
+   type 

[PATCH] osmo-ttcn3-hacks[master]: bts: Type Definition + Template for SI3; Send SI3 at start o...

2018-02-24 Thread Harald Welte

Review at  https://gerrit.osmocom.org/6885

bts: Type Definition + Template for SI3; Send SI3 at start of test

The BTS needs some of the SI3 parameters like BS_AG_BLKS_RES for
internal computations, so make sure we send it after the connection
has been established.

Change-Id: I5dc3724f79e669f52593cd776806d84b4dd4bf5c
---
M bts/BTS_Tests.ttcn
M library/GSM_RR_Types.ttcn
M library/General_Types.ttcn
M library/L3_Templates.ttcn
4 files changed, 130 insertions(+), 1 deletion(-)


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

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 58c7118..3bf412e 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -20,6 +20,9 @@
 import from TRXC_CodecPort all;
 import from TRXC_CodecPort_CtrlFunct all;
 
+import from L3_Templates all;
+import from MobileL3_CommonIE_Types all;
+
 /* The tests assume a BTS with the following timeslot configuration:
  * TS0 : Combined CCCH + SDCCH/4
  * TS1 .. TS 4: TCH/F
@@ -75,11 +78,62 @@
ConnL1Pars l1_pars
 }
 
+/* Default SYSTEM INFORMATION 3 */
+template (value) GsmRrMessage ts_SI3_default := {
+   header := t_RrHeader(SYSTEM_INFORMATION_TYPE_3, 0),
+   payload := {
+   si3 := {
+   cell_id := 23,
+   lai := {
+   mcc_mnc := '262F42'H,
+   lac := 42
+   },
+   ctrl_chan_desc := {
+   msc_r99 := true,
+   att := true,
+   bs_ag_blks_res := 1,
+   ccch_conf := CCHAN_DESC_1CCCH_COMBINED,
+   si22_ind := false,
+   cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED,
+   spare := '00'B,
+   bs_pa_mfrms := 0, /* 2 multiframes */
+   t3212 := 1 /* 6 minutes */
+   },
+   cell_opts := {
+   dn_ind := false,
+   pwrc := false,
+   dtx := MS_MAY_USE_UL_DTX,
+   radio_link_tout_div4 := 4/4
+   },
+   cell_sel_pars := {
+   cell_resel_hyst_2dB := 0,
+   ms_txpwr_max_cch := 0,
+   acs := '0'B,
+   neci := true,
+   rxlev_access_min := 0
+   },
+   rach_ctrl_pars := {
+   max_retrans := RACH_MAX_RETRANS_1,
+   tx_integer := ''B, /* 3 slots */
+   cell_bar_access := false,
+   re_not_allowed := true,
+   acc := ''B
+   },
+   rest_octets := ''O
+   }
+   }
+}
 
 /* global init function */
 function f_init(charstring id) runs on test_CT {
f_init_rsl(id);
RSL_CCHAN.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP});
+
+   /* Send SI3 to the BTS, it is needed for various computations */
+   var GsmRrMessage si3 := valueof(ts_SI3_default);
+   log("Sending SI3 ", si3);
+   var octetstring si3_enc := enc_GsmRrMessage(si3);
+   RSL_CCHAN.send(ts_RSL(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_3, si3_enc)));
 }
 
 type function void_fn(charstring id) runs on ConnHdlr;
diff --git a/library/GSM_RR_Types.ttcn b/library/GSM_RR_Types.ttcn
index 4d1efd7..a8b6db2 100644
--- a/library/GSM_RR_Types.ttcn
+++ b/library/GSM_RR_Types.ttcn
@@ -366,6 +366,68 @@
uint3_t non_drx_timer
} with { variant "" };
 
+   /* 44.018 10.5.2.3 */
+   type enumerated CellOptions_DTX {
+   MS_MAY_USE_UL_DTX   ('00'B),
+   MS_SHALL_USE_UL_DTX ('01'B),
+   MS_SHALL_NOT_USE_UL_DTX ('10'B)
+   } with { variant "FIELDLENGTH(2)" };
+   type record CellOptions {
+   boolean dn_ind,
+   boolean pwrc,
+   CellOptions_DTX dtx,
+   uint4_t radio_link_tout_div4
+   } with { variant "" };
+
+   /* 44.018 10.5.2.4 */
+   type record CellSelectionPars {
+   uint3_t cell_resel_hyst_2dB,
+   uint5_t ms_txpwr_max_cch,
+   BIT1acs,
+   boolean neci,
+   uint6_t rxlev_access_min
+   } with { variant "" };
+
+   /* 44.018 10.5.2.29 */
+   type enumerated RachCtrlPar_MR {
+   RACH_MAX_RETRANS_1  ('00'B),
+   RACH_MAX_RETRANS_2  ('01'B),
+   RACH_MAX_RETRANS_4  ('10'B),
+   RACH_MAX_RETRANS_7  ('11'B)
+   } with {