Change in osmo-ttcn3-hacks[master]: pcu: Add infra to handle multitrx and multits envs

2020-11-06 Thread pespin
pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968 )

Change subject: pcu: Add infra to handle multitrx and multits envs
..

pcu: Add infra to handle multitrx and multits envs

ARFCNs are allocated sequentially, so that conversion between
arfcn<->trx_nr is easily done.

Some helper functions are introduced to be able to submit and expect
messages on a given TRX+TS, which is required for setups with several
TRX and PDCH-enabled TS different than the default. These new APIs
will be used in PCU_Tests.ttcn in subsequent patches.

Change-Id: I28430e6d8c77d2b7dc630d186d425a5d82587b82
---
M library/PCUIF_Types.ttcn
M pcu/GPRS_Components.ttcn
M pcu/PCU_Tests.ttcn
3 files changed, 87 insertions(+), 18 deletions(-)

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



diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn
index 8af3757..a7a32ab 100644
--- a/library/PCUIF_Types.ttcn
+++ b/library/PCUIF_Types.ttcn
@@ -815,21 +815,21 @@

 template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09TrxNULL := 
ts_PCUIF_InfoV09Trx(0, ''B, '00'O);

-template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def := {
+template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def(uint16_t base_arfcn) 
:= {
v09 := {
-   ts_PCUIF_InfoV09Trx, ts_PCUIF_InfoV09TrxNULL,
+   ts_PCUIF_InfoV09Trx(arfcn := base_arfcn + 0), 
ts_PCUIF_InfoV09TrxNULL,
ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL
}
 };

-template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def := {
+template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def(uint16_t base_arfcn) 
:= {
v10 := {
-   ts_PCUIF_InfoV10Trx(arfcn := 871), ts_PCUIF_InfoV10Trx(arfcn := 
872),
-   ts_PCUIF_InfoV10Trx(arfcn := 873), ts_PCUIF_InfoV10Trx(arfcn := 
874),
-   ts_PCUIF_InfoV10Trx(arfcn := 875), ts_PCUIF_InfoV10Trx(arfcn := 
876),
-   ts_PCUIF_InfoV10Trx(arfcn := 877), ts_PCUIF_InfoV10Trx(arfcn := 
878)
+   ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 0), 
ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 1),
+   ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 2), 
ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 3),
+   ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 4), 
ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 5),
+   ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 6), 
ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 7)
}
 };

@@ -972,12 +972,12 @@


 /* TODO: remove this as soon as we drop version 9 support */
-function f_PCUIF_ver_INFO_Trxs()
+function f_PCUIF_ver_INFO_Trxs(uint16_t base_arfcn)
 return PCUIF_InfoTrxs {
if (PCUIF_Types.mp_pcuif_version >= 10) {
-   return valueof(ts_PCUIF_InfoV10Trxs_def);
+   return valueof(ts_PCUIF_InfoV10Trxs_def(base_arfcn));
} else {
-   return valueof(ts_PCUIF_InfoV09Trxs_def);
+   return valueof(ts_PCUIF_InfoV09Trxs_def(base_arfcn));
}
 }

diff --git a/pcu/GPRS_Components.ttcn b/pcu/GPRS_Components.ttcn
index 9dd4650..f2b0efb 100644
--- a/pcu/GPRS_Components.ttcn
+++ b/pcu/GPRS_Components.ttcn
@@ -29,6 +29,11 @@
 import from PCUIF_Components all;
 import from Native_Functions all;

+modulepar {
+   /* ARFCN of 1st TRX. Subsequent TRX are allocated incrementing ARFCNs. 
Nth TRX => base_arfcn + N-1 */
+   GsmArfcn mp_base_arfcn := 871;
+};
+
 type record TsTrxBtsNum {
uint3_t ts_nr,
uint3_t trx_nr,
@@ -64,7 +69,7 @@
GsmRrMessagerr_imm_ass optional,
PacketDlAssignChan  ass optional,
uint5_t tfi,
-   GsmArfcnarfcn,
+   GsmArfcnarfcn optional,
BIT8ts_mask,
AckNackDescription  acknack_desc
 };
@@ -79,7 +84,7 @@
GsmRrMessagerr_imm_ass optional,
PacketUlAssignChan  ass optional,
uint5_t tfi,
-   GsmArfcnarfcn,
+   GsmArfcnarfcn optional,
BIT8ts_mask,
uint3_t usf[8],
boolean is_egprs,
@@ -124,7 +129,7 @@
rr_imm_ass := omit,
ass := omit,
tfi := 0,
-   arfcn := 0,
+   arfcn := omit,
ts_mask := ''B,
acknack_desc := t_AckNackDescription_init
 };
@@ -133,7 +138,7 @@
rr_imm_ass := omit,
ass := omit,
tfi := 0,
-   arfcn := 0,
+   arfcn := omit,
ts_mask := ''B,
usf := { USF_UNUSED, USF_UNUSED, USF_UNUSED, USF_UNUSED, USF_UNUSED, 
USF_UNUSED, USF_UNUSED, USF_UNUSED },
is_egprs := false,
@@ -199,6 +204,18 @@
mtc.stop;
 }

+function 

Change in osmo-ttcn3-hacks[master]: pcu: Add infra to handle multitrx and multits envs

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

Change subject: pcu: Add infra to handle multitrx and multits envs
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968
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: I28430e6d8c77d2b7dc630d186d425a5d82587b82
Gerrit-Change-Number: 20968
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Fri, 06 Nov 2020 13:03:34 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: pcu: Add infra to handle multitrx and multits envs

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

Change subject: pcu: Add infra to handle multitrx and multits envs
..


Patch Set 3:

Ping. This commit (and next ones in patchset) have been here waiting most of 
the current week after the requested changes were made.


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968
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: I28430e6d8c77d2b7dc630d186d425a5d82587b82
Gerrit-Change-Number: 20968
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Fri, 06 Nov 2020 12:59:29 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: pcu: Add infra to handle multitrx and multits envs

2020-11-02 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968 )

Change subject: pcu: Add infra to handle multitrx and multits envs
..


Patch Set 3:

(1 comment)

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn
File pcu/GPRS_Components.ttcn:

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn@370
PS2, Line 370: inout
> in (a.k.a. […]
I think the object is then copied, because you can still call 
"f_ultbf_next_ts(ms.ul_tbf);" which uses an inout.



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968
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: I28430e6d8c77d2b7dc630d186d425a5d82587b82
Gerrit-Change-Number: 20968
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Mon, 02 Nov 2020 19:36:58 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: pcu: Add infra to handle multitrx and multits envs

2020-11-02 Thread pespin
Hello Jenkins Builder, laforge, fixeria,

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

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

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

Change subject: pcu: Add infra to handle multitrx and multits envs
..

pcu: Add infra to handle multitrx and multits envs

ARFCNs are allocated sequentially, so that conversion between
arfcn<->trx_nr is easily done.

Some helper functions are introduced to be able to submit and expect
messages on a given TRX+TS, which is required for setups with several
TRX and PDCH-enabled TS different than the default. These new APIs
will be used in PCU_Tests.ttcn in subsequent patches.

Change-Id: I28430e6d8c77d2b7dc630d186d425a5d82587b82
---
M library/PCUIF_Types.ttcn
M pcu/GPRS_Components.ttcn
M pcu/PCU_Tests.ttcn
3 files changed, 87 insertions(+), 18 deletions(-)


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


Change in osmo-ttcn3-hacks[master]: pcu: Add infra to handle multitrx and multits envs

2020-10-31 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968 )

Change subject: pcu: Add infra to handle multitrx and multits envs
..


Patch Set 2: Code-Review-1

(10 comments)

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn
File pcu/GPRS_Components.ttcn:

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn@205
PS2, Line 205: uint10_t
GsmArfcn


https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn@213
PS2, Line 213: uint10_t
GsmArfcn


https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn@370
PS2, Line 370: inout
in (a.k.a. the 'const')


https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn@375
PS2, Line 375: arfcn != 0
ARFCN 0 is a valid ARFCN. Maybe rather make it 'optional' and call ispresent() 
here?


https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn@379
PS2, Line 379: trx_nr := 7;
I am afraid it would be hard to debug this if some day we decide to add some 
new hopping test cases, so I would setverdict(fail, ...) and call f_shutdown() 
here.


https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn@384
PS2, Line 384: inout
in (a.k.a. the 'const')


https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn@386
PS2, Line 386: uint3_t
You're using restricted types without the need... Maximum number of slots would 
be 8, while the UINT8_MAX is 7. Let's better use integer. It's not a protocol 
definition after all.

P.S. I am now wondering how TITAN handles integer overflows. Would it throw a 
DTE?


https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn@401
PS2, Line 401: inout
in (a.k.a. the 'const')


https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn@415
PS2, Line 415: inout
in (a.k.a. the 'const')


https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968/2/pcu/GPRS_Components.ttcn@417
PS2, Line 417: uint3_t
Again, integer overflow if pdch_mask == ''B.



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968
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: I28430e6d8c77d2b7dc630d186d425a5d82587b82
Gerrit-Change-Number: 20968
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Sat, 31 Oct 2020 11:42:40 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: pcu: Add infra to handle multitrx and multits envs

2020-10-30 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968 )

Change subject: pcu: Add infra to handle multitrx and multits envs
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968
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: I28430e6d8c77d2b7dc630d186d425a5d82587b82
Gerrit-Change-Number: 20968
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Fri, 30 Oct 2020 09:00:14 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: pcu: Add infra to handle multitrx and multits envs

2020-10-29 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20968 )


Change subject: pcu: Add infra to handle multitrx and multits envs
..

pcu: Add infra to handle multitrx and multits envs

ARFCNs are allocated sequentially, so that conversion between
arfcn<->trx_nr is easily done.

Some helper functions are introduced to be able to submit and expect
messages on a given TRX+TS, which is required for setups with several
TRX and PDCH-enabled TS different than the default. These new APIs
will be used in PCU_Tests.ttcn in subsequent patches.

Change-Id: I28430e6d8c77d2b7dc630d186d425a5d82587b82
---
M library/PCUIF_Types.ttcn
M pcu/GPRS_Components.ttcn
M pcu/PCU_Tests.ttcn
3 files changed, 82 insertions(+), 14 deletions(-)



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

diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn
index b50e4c5..935f82b 100644
--- a/library/PCUIF_Types.ttcn
+++ b/library/PCUIF_Types.ttcn
@@ -815,21 +815,21 @@

 template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09TrxNULL := 
ts_PCUIF_InfoV09Trx(0, ''B, '00'O);

-template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def := {
+template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def(uint16_t base_arfcn) 
:= {
v09 := {
-   ts_PCUIF_InfoV09Trx, ts_PCUIF_InfoV09TrxNULL,
+   ts_PCUIF_InfoV09Trx(arfcn := base_arfcn + 0), 
ts_PCUIF_InfoV09TrxNULL,
ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL
}
 };

-template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def := {
+template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def(uint16_t base_arfcn) 
:= {
v10 := {
-   ts_PCUIF_InfoV10Trx(arfcn := 871), ts_PCUIF_InfoV10Trx(arfcn := 
872),
-   ts_PCUIF_InfoV10Trx(arfcn := 873), ts_PCUIF_InfoV10Trx(arfcn := 
874),
-   ts_PCUIF_InfoV10Trx(arfcn := 875), ts_PCUIF_InfoV10Trx(arfcn := 
876),
-   ts_PCUIF_InfoV10Trx(arfcn := 877), ts_PCUIF_InfoV10Trx(arfcn := 
878)
+   ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 0), 
ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 1),
+   ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 2), 
ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 3),
+   ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 4), 
ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 5),
+   ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 6), 
ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 7)
}
 };

@@ -972,12 +972,12 @@


 /* TODO: remove this as soon as we drop version 9 support */
-function f_PCUIF_ver_INFO_Trxs()
+function f_PCUIF_ver_INFO_Trxs(uint16_t base_arfcn)
 return PCUIF_InfoTrxs {
if (PCUIF_Types.mp_pcuif_version >= 10) {
-   return valueof(ts_PCUIF_InfoV10Trxs_def);
+   return valueof(ts_PCUIF_InfoV10Trxs_def(base_arfcn));
} else {
-   return valueof(ts_PCUIF_InfoV09Trxs_def);
+   return valueof(ts_PCUIF_InfoV09Trxs_def(base_arfcn));
}
 }

diff --git a/pcu/GPRS_Components.ttcn b/pcu/GPRS_Components.ttcn
index c460e25..5ca32dd 100644
--- a/pcu/GPRS_Components.ttcn
+++ b/pcu/GPRS_Components.ttcn
@@ -44,6 +44,11 @@
 import from Native_Functions all;
 import from SGSN_Components all;

+modulepar {
+   /* ARFCN of 1st TRX. Subsequent TRX are allocated incrementing ARFCNs. 
Nth TRX => base_arfcn + N-1 */
+   GsmArfcn mp_base_arfcn := 871;
+};
+
 type record TsTrxBtsNum {
uint3_t ts_nr,
uint3_t trx_nr,
@@ -201,6 +206,18 @@
mtc.stop;
 }

+function f_arfcn2trxnr(uint10_t arfcn) runs on MS_BTS_IFACE_CT return uint3_t {
+   if (arfcn < mp_base_arfcn) {
+   setverdict(fail, "Unable to find TRX NR for arfcn ", arfcn);
+   f_shutdown(__BFILE__, __LINE__);
+   }
+   return arfcn - mp_base_arfcn;
+}
+
+function f_trxnr2arfcn(uint3_t trx_nr) return uint10_t {
+   return mp_base_arfcn + trx_nr;
+}
+
 function f_ultbf_new_from_rr_imm_ass(in GsmRrMessage rr_imm_ass)
 runs on MS_BTS_IFACE_CT return UlTbf {
var UlTbf ul_tbf := valueof(t_UlTbf_def);
@@ -394,12 +411,62 @@
return dl_tbf;
 }

+function f_ms_tx_TsTrxBtsNum(inout GprsMS ms)
+runs on MS_BTS_IFACE_CT return TsTrxBtsNum {
+   var uint3_t ts_nr := f_ultbf_next_ts(ms.ul_tbf);
+
+   var uint3_t trx_nr;
+   if (ms.ul_tbf.arfcn != 0) {
+   trx_nr := f_arfcn2trxnr(ms.ul_tbf.arfcn);
+   } else {
+   /* FIXME: implement search by hsn+maio+ma when freq hopping is 
enabled */
+   trx_nr := 7;
+   }
+   return valueof(ts_TsTrxBtsNum(ts_nr, trx_nr));
+}
+
+function f_dltbf_num_slots(inout DlTbf dl_tbf)
+runs on MS_BTS_IFACE_CT return uint3_t  {
+   var uint3_t n := 0;
+   for