Change in ...osmo-ttcn3-hacks[master]: BTS: add some dynamic power control tests

2019-06-12 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417 )

Change subject: BTS: add some dynamic power control tests
..

BTS: add some dynamic power control tests

Change-Id: I57489ba22542d859ced767e856634f9060c060f0
---
M bts/BTS_Tests.ttcn
M library/RSL_Types.ttcn
2 files changed, 380 insertions(+), 2 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 3244b48..2d2ae0b 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -193,7 +193,8 @@
float t_guard,
ConnL1Pars l1_pars,
TestSpecUnion spec optional,
-   RSL_IE_EncryptionInfo encr optional
+   RSL_IE_EncryptionInfo encr optional,
+   BtsBand bts0_band optional
 }

 /* Test-specific parameters */
@@ -594,7 +595,8 @@
ms_actual_ta := mp_ms_actual_ta_exp
},
spec := omit,
-   encr := omit
+   encr := omit,
+   bts0_band := omit
 }

 /***
@@ -1890,6 +1892,352 @@
f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
 }

+/* target level -100, first rssi -90, ms power 7, expected increase to 7+6 
within 6 seconds,
+second rssi -110, ms power 7+6, expected decrease to 7 within 6 seconds,
+These power levels are valid for all bands and require no special handling */
+function f_TC_rsl_ms_pwr_dyn_ass_updown(charstring id) runs on ConnHdlr {
+   var uint5_t pwr_var := 7;
+   var L1ctlDlMessage l1_dl;
+
+   f_trxc_fake_rssi(rxlev2dbm(10));
+   f_l1_tune(L1CTL);
+   RSL.clear;
+
+   var RSL_IE_List addl_ies;
+   var template (value)  RSL_IE_MS_Power_Parameters pp := 
(ts_RSL_IE_MS_Power_Parameters(''O));
+
+   addl_ies := {
+   valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := 
ts_RSL_IE_MS_Power(pwr_var)})),
+   valueof(t_RSL_IE(RSL_IE_MS_POWER_PARAM, 
RSL_IE_Body:{ms_power_params := pp}))
+   };
+
+   /* establish with power parameters */
+   f_est_dchan(more_ies := addl_ies);
+
+   /* set a high value to ensure L1 power control level increases */
+   f_trxc_fake_rssi(rxlev2dbm(20));
+
+   timer T2 := 6.0;
+   T2.start;
+   alt {
+   [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) 
-> value l1_dl {
+   if( not(oct2int(l1_dl.payload.data_ind.payload[0]) > 
(pwr_var+6))){
+   repeat;
+   }
+   T2.stop;
+   }
+   [] L1CTL.receive { repeat; }
+   [] T2.timeout {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+   "Power Level in L1 header has not increased 
sufficiently");
+   }
+   }
+
+   /* set a low value to ensure L1 power control level decreases */
+   f_trxc_fake_rssi(rxlev2dbm(0));
+
+   timer T4 := 6.0;
+   T4.start;
+   alt {
+   [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) 
-> value l1_dl {
+   if( not(oct2int(l1_dl.payload.data_ind.payload[0]) <= 
(pwr_var))){
+   repeat;
+   }
+   T4.stop;
+   setverdict(pass, "Power level in L1 decreased/increased as 
expected");
+   }
+   [] L1CTL.receive { repeat; }
+   [] T4.timeout {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+   "Power Level in L1 header has not decreased 
sufficiently");
+   }
+   }
+
+   f_rsl_chan_deact();
+   f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
+
+}
+
+/* check that we do not exceed the max power */
+function f_TC_rsl_ms_pwr_dyn_max(charstring id) runs on ConnHdlr {
+   var uint5_t pwr_var := 7;
+   var L1ctlDlMessage l1_dl;
+
+   /* set a low value to ensure power increases */
+   f_trxc_fake_rssi(rxlev2dbm(10));
+   f_l1_tune(L1CTL);
+   RSL.clear;
+
+   var RSL_IE_List addl_ies;
+   var template (value)  RSL_IE_MS_Power_Parameters pp := 
(ts_RSL_IE_MS_Power_Parameters(''O));
+
+   addl_ies := {
+   valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := 
ts_RSL_IE_MS_Power(pwr_var)})),
+   valueof(t_RSL_IE(RSL_IE_MS_POWER_PARAM, 
RSL_IE_Body:{ms_power_params := pp}))
+   };
+
+   /* establish with power parameters */
+   f_est_dchan(more_ies := addl_ies);
+
+   timer T1 := 10.0;
+   T1.start;
+   alt {
+   [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) 
-> value l1_dl { repeat; }
+   [] L1CTL.receive { repeat; }
+   [] T1.timeout {
+   if( oct2int(l1_dl.payload.data_ind.payload[0]) != pwr_var){
+   setverdict(fail, "Power level in L1 header should not 
have changed");
+   }
+  

Change in ...osmo-ttcn3-hacks[master]: BTS: add some dynamic power control tests

2019-06-12 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417 )

Change subject: BTS: add some dynamic power control tests
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417
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: I57489ba22542d859ced767e856634f9060c060f0
Gerrit-Change-Number: 14417
Gerrit-PatchSet: 4
Gerrit-Owner: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Wed, 12 Jun 2019 20:16:41 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: BTS: add some dynamic power control tests

2019-06-12 Thread Hoernchen
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417

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

Change subject: BTS: add some dynamic power control tests
..

BTS: add some dynamic power control tests

Change-Id: I57489ba22542d859ced767e856634f9060c060f0
---
M bts/BTS_Tests.ttcn
M library/RSL_Types.ttcn
2 files changed, 380 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/17/14417/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417
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: I57489ba22542d859ced767e856634f9060c060f0
Gerrit-Change-Number: 14417
Gerrit-PatchSet: 4
Gerrit-Owner: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge 
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: BTS: add some dynamic power control tests

2019-06-11 Thread Hoernchen
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417

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

Change subject: BTS: add some dynamic power control tests
..

BTS: add some dynamic power control tests

Change-Id: I57489ba22542d859ced767e856634f9060c060f0
---
M bts/BTS_Tests.ttcn
M library/RSL_Types.ttcn
2 files changed, 380 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/17/14417/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417
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: I57489ba22542d859ced767e856634f9060c060f0
Gerrit-Change-Number: 14417
Gerrit-PatchSet: 3
Gerrit-Owner: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge 
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: BTS: add some dynamic power control tests

2019-06-11 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417 )

Change subject: BTS: add some dynamic power control tests
..


Patch Set 2:

(6 comments)

https://gerrit.osmocom.org/#/c/14417/2/bts/BTS_Tests.ttcn
File bts/BTS_Tests.ttcn:

https://gerrit.osmocom.org/#/c/14417/2/bts/BTS_Tests.ttcn@1974
PS2, Line 1974: pp := valueof(ts_RSL_IE_MS_Power_Parameters('aabbcc'O));
I would consider sending an empty octet string ''O to ensure we're not 
confusing the receiver.  Sure, at them moment OsmoBTs doesn't implement any 
parameters, but in the future we might.  Using an empty IE fulfills the 
requirement of having that element present (and hence enabling BTS-side power 
control), but at the same time has low risk of breaking something that actually 
might interpret aabbcc as actual parameters.


https://gerrit.osmocom.org/#/c/14417/2/bts/BTS_Tests.ttcn@2028
PS2, Line 2028:
I would avoid the 'rsl' variable here. As RSL.send() can take the send template 
directly, it also means you save the valueof().  Sure, it's just stylistic, not 
important...


https://gerrit.osmocom.org/#/c/14417/2/bts/BTS_Tests.ttcn@2062
PS2, Line 2062:
  : var RSL_IE_MS_Power ms_power;
  : ms_power := valueof(ts_RSL_IE_MS_Power(pwr_var));
  : var RSL_IE pwr;
  : pwr  := valueof(t_RSL_IE(RSL_IE_MS_POWER, 
RSL_IE_Body:{ms_power := ms_power}));
again here I'd typically try to avoid the local variables, as they force you to 
do valueof() all the time, which sort of makes templates less nice to use.  The 
alternative if you want the local variables would be to define them as template 
variables, so 'var template RSL_IE_MS_Power ms_power := 
ts_RSL_IE_MS_Power(pwr_var);' would do the trick, maybe even var template 
(value) ...


https://gerrit.osmocom.org/#/c/14417/2/bts/BTS_Tests.ttcn@2165
PS2, Line 2165: if((band == "GSM450")
if if were a function, one wouldn't have spaces before the parenthesis :P


https://gerrit.osmocom.org/#/c/14417/2/bts/BTS_Tests.ttcn@2166
PS2, Line 2166: or (band == "GSM480")
I would typically have used a select/case construct here, not having to repeat 
"band ==" in every line.  The nice part about the select/case in TTCN3 is that 
every "case" is a template match.  So you can define a charstring template 
matching all those bands that equal in their treatment and then have a single 
line. case (t_my_bands) { ... }

But once again, just a stylistic comment, no absolute need to change the code.


https://gerrit.osmocom.org/#/c/14417/2/bts/BTS_Tests.ttcn@2264
PS2, Line 2264:
unrelated whitespace



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417
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: I57489ba22542d859ced767e856634f9060c060f0
Gerrit-Change-Number: 14417
Gerrit-PatchSet: 2
Gerrit-Owner: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge 
Gerrit-Comment-Date: Tue, 11 Jun 2019 14:53:26 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: BTS: add some dynamic power control tests

2019-06-11 Thread Hoernchen
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417

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

Change subject: BTS: add some dynamic power control tests
..

BTS: add some dynamic power control tests

Change-Id: I57489ba22542d859ced767e856634f9060c060f0
---
M bts/BTS_Tests.ttcn
M library/RSL_Types.ttcn
2 files changed, 392 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/17/14417/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417
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: I57489ba22542d859ced767e856634f9060c060f0
Gerrit-Change-Number: 14417
Gerrit-PatchSet: 2
Gerrit-Owner: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: BTS: add some dynamic power control tests

2019-06-11 Thread Hoernchen
Hoernchen has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14417


Change subject: BTS: add some dynamic power control tests
..

BTS: add some dynamic power control tests

Change-Id: I57489ba22542d859ced767e856634f9060c060f0
---
M bts/BTS_Tests.ttcn
M library/RSL_Types.ttcn
2 files changed, 392 insertions(+), 2 deletions(-)



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

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 3244b48..01170f0 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -193,7 +193,8 @@
float t_guard,
ConnL1Pars l1_pars,
TestSpecUnion spec optional,
-   RSL_IE_EncryptionInfo encr optional
+   RSL_IE_EncryptionInfo encr optional,
+   BtsBand bts0_band optional
 }

 /* Test-specific parameters */
@@ -594,7 +595,8 @@
ms_actual_ta := mp_ms_actual_ta_exp
},
spec := omit,
-   encr := omit
+   encr := omit,
+   bts0_band := omit
 }
 
 /***
@@ -1890,6 +1892,363 @@
f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
 }

+/* target level -100, first rssi -90, ms power 7, expected increase to 7+6 
within 6 seconds,
+second rssi -110, ms power 7+6, expected decrease to 7 within 6 seconds,
+These power levels are valid for all bands and require no special handling */
+function f_TC_rsl_ms_pwr_dyn_ass_updown(charstring id) runs on ConnHdlr {
+   var uint5_t pwr_var := 7;
+   var L1ctlDlMessage l1_dl;
+
+   f_trxc_fake_rssi(rxlev2dbm(10));
+   f_l1_tune(L1CTL);
+   RSL.clear;
+
+   var RSL_IE_List addl_ies;
+   var RSL_IE_MS_Power_Parameters pp;
+   pp := valueof(ts_RSL_IE_MS_Power_Parameters('aabbcc'O));
+
+   addl_ies := {
+   valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := 
ts_RSL_IE_MS_Power(pwr_var)})),
+   valueof(t_RSL_IE(RSL_IE_MS_POWER_PARAM, 
RSL_IE_Body:{ms_power_params := pp}))
+   };
+
+   /* establish with power parameters */
+   f_est_dchan(more_ies := addl_ies);
+
+   /* set a high value to ensure L1 power control level increases */
+   f_trxc_fake_rssi(rxlev2dbm(20));
+
+   timer T2 := 6.0;
+   T2.start;
+   alt {
+   [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) 
-> value l1_dl {
+   if( not(oct2int(l1_dl.payload.data_ind.payload[0]) > 
(pwr_var+6))){
+   repeat;
+   }
+   T2.stop;
+   }
+   [] L1CTL.receive { repeat; }
+   [] T2.timeout {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+   "Power Level in L1 header has not increased 
sufficiently");
+   }
+   }
+
+   /* set a low value to ensure L1 power control level decreases */
+   f_trxc_fake_rssi(rxlev2dbm(0));
+
+   timer T4 := 6.0;
+   T4.start;
+   alt {
+   [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) 
-> value l1_dl {
+   if( not(oct2int(l1_dl.payload.data_ind.payload[0]) <= 
(pwr_var))){
+   repeat;
+   }
+   T4.stop;
+   setverdict(pass, "Power level in L1 decreased/increased as 
expected");
+   }
+   [] L1CTL.receive { repeat; }
+   [] T4.timeout {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+   "Power Level in L1 header has not decreased 
sufficiently");
+   }
+   }
+
+   f_rsl_chan_deact();
+   f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
+
+}
+
+/* check that we do not exceed the max power */
+function f_TC_rsl_ms_pwr_dyn_max(charstring id) runs on ConnHdlr {
+   var uint5_t pwr_var := 7;
+   var L1ctlDlMessage l1_dl;
+
+   /* set a low value to ensure power increases */
+   f_trxc_fake_rssi(rxlev2dbm(10));
+   f_l1_tune(L1CTL);
+   RSL.clear;
+
+   var RSL_IE_List addl_ies;
+   var RSL_IE_MS_Power_Parameters pp;
+   pp := valueof(ts_RSL_IE_MS_Power_Parameters('aabbcc'O));
+
+   addl_ies := {
+   valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := 
ts_RSL_IE_MS_Power(pwr_var)})),
+   valueof(t_RSL_IE(RSL_IE_MS_POWER_PARAM, 
RSL_IE_Body:{ms_power_params := pp}))
+   };
+
+   /* establish with power parameters */
+   f_est_dchan(more_ies := addl_ies);
+
+   timer T1 := 10.0;
+   T1.start;
+   alt {
+   [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) 
-> value l1_dl { repeat; }
+   [] L1CTL.receive { repeat; }
+   [] T1.timeout {
+   if( oct2int(l1_dl.payload.data_ind.payload[0]) != pwr_var){
+   setverdict(fail, "Power level in L1 header should not 
have changed");
+   

Change in ...osmo-ttcn3-hacks[master]: BTS: add some dynamic power control tests

2019-06-11 Thread Hoernchen
Hoernchen has abandoned this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14416 )

Change subject: BTS: add some dynamic power control tests
..


Abandoned

i broke my git
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14416
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: I8a860e6a0371f7e6bbe06d69bd78df607922ef7f
Gerrit-Change-Number: 14416
Gerrit-PatchSet: 2
Gerrit-Owner: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: abandon


Change in ...osmo-ttcn3-hacks[master]: BTS: add some dynamic power control tests

2019-06-11 Thread Hoernchen
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14416

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

Change subject: BTS: add some dynamic power control tests
..

BTS: add some dynamic power control tests

Change-Id: I8a860e6a0371f7e6bbe06d69bd78df607922ef7f
---
M bts/BTS_Tests.ttcn
M library/RSL_Types.ttcn
2 files changed, 392 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/16/14416/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14416
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: I8a860e6a0371f7e6bbe06d69bd78df607922ef7f
Gerrit-Change-Number: 14416
Gerrit-PatchSet: 2
Gerrit-Owner: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: BTS: add some dynamic power control tests

2019-06-11 Thread Hoernchen
Hoernchen has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14416


Change subject: BTS: add some dynamic power control tests
..

BTS: add some dynamic power control tests

Change-Id: I8a860e6a0371f7e6bbe06d69bd78df607922ef7f
---
M bts/BTS_Tests.ttcn
M library/RSL_Types.ttcn
2 files changed, 408 insertions(+), 2 deletions(-)



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

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 3244b48..10574a8 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -193,7 +193,8 @@
float t_guard,
ConnL1Pars l1_pars,
TestSpecUnion spec optional,
-   RSL_IE_EncryptionInfo encr optional
+   RSL_IE_EncryptionInfo encr optional,
+   BtsBand bts0_band optional
 }

 /* Test-specific parameters */
@@ -594,7 +595,8 @@
ms_actual_ta := mp_ms_actual_ta_exp
},
spec := omit,
-   encr := omit
+   encr := omit,
+   bts0_band := omit
 }
 
 /***
@@ -1890,6 +1892,363 @@
f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
 }

+/* target level -100, first rssi -90, ms power 7, expected increase to 7+6 
within 6 seconds,
+second rssi -110, ms power 7+6, expected decrease to 7 within 6 seconds,
+These power levels are valid for all bands and require no special handling */
+function f_TC_rsl_ms_pwr_dyn_ass_updown(charstring id) runs on ConnHdlr {
+   var uint5_t pwr_var := 7;
+   var L1ctlDlMessage l1_dl;
+
+   f_trxc_fake_rssi(rxlev2dbm(10));
+   f_l1_tune(L1CTL);
+   RSL.clear;
+
+   var RSL_IE_List addl_ies;
+   var RSL_IE_MS_Power_Parameters pp;
+   pp := valueof(ts_RSL_IE_MS_Power_Parameters('aabbcc'O));
+
+   addl_ies := {
+   valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := 
ts_RSL_IE_MS_Power(pwr_var)})),
+   valueof(t_RSL_IE(RSL_IE_MS_POWER_PARAM, 
RSL_IE_Body:{ms_power_params := pp}))
+   };
+
+   /* establish with power parameters */
+   f_est_dchan(more_ies := addl_ies);
+
+   /* set a high value to ensure L1 power control level increases */
+   f_trxc_fake_rssi(rxlev2dbm(20));
+
+   timer T2 := 6.0;
+   T2.start;
+   alt {
+   [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) 
-> value l1_dl {
+   if( not(oct2int(l1_dl.payload.data_ind.payload[0]) > 
(pwr_var+6))){
+   repeat;
+   }
+   T2.stop;
+   }
+   [] L1CTL.receive { repeat; }
+   [] T2.timeout {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+   "Power Level in L1 header has not increased 
sufficiently");
+   }
+   }
+
+   /* set a low value to ensure L1 power control level decreases */
+   f_trxc_fake_rssi(rxlev2dbm(0));
+
+   timer T4 := 6.0;
+   T4.start;
+   alt {
+   [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) 
-> value l1_dl {
+   if( not(oct2int(l1_dl.payload.data_ind.payload[0]) <= 
(pwr_var))){
+   repeat;
+   }
+   T4.stop;
+   setverdict(pass, "Power level in L1 decreased/increased as 
expected");
+   }
+   [] L1CTL.receive { repeat; }
+   [] T4.timeout {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+   "Power Level in L1 header has not decreased 
sufficiently");
+   }
+   }
+
+   f_rsl_chan_deact();
+   f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
+
+}
+
+/* check that we do not exceed the max power */
+function f_TC_rsl_ms_pwr_dyn_max(charstring id) runs on ConnHdlr {
+   var uint5_t pwr_var := 7;
+   var L1ctlDlMessage l1_dl;
+
+   /* set a low value to ensure power increases */
+   f_trxc_fake_rssi(rxlev2dbm(10));
+   f_l1_tune(L1CTL);
+   RSL.clear;
+
+   var RSL_IE_List addl_ies;
+   var RSL_IE_MS_Power_Parameters pp;
+   pp := valueof(ts_RSL_IE_MS_Power_Parameters('aabbcc'O));
+
+   addl_ies := {
+   valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := 
ts_RSL_IE_MS_Power(pwr_var)})),
+   valueof(t_RSL_IE(RSL_IE_MS_POWER_PARAM, 
RSL_IE_Body:{ms_power_params := pp}))
+   };
+
+   /* establish with power parameters */
+   f_est_dchan(more_ies := addl_ies);
+
+   timer T1 := 10.0;
+   T1.start;
+   alt {
+   [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) 
-> value l1_dl { repeat; }
+   [] L1CTL.receive { repeat; }
+   [] T1.timeout {
+   if( oct2int(l1_dl.payload.data_ind.payload[0]) != pwr_var){
+   setverdict(pass, "Power level in L1 header should not 
have changed");
+