Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce some function helpers

2019-10-07 Thread pespin
pespin has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664 )

Change subject: pcu: Introduce some function helpers
..

pcu: Introduce some function helpers

Change-Id: I8608fac4375153d5020df5d05026513a7fe931d6
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 49 insertions(+), 18 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved



diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index b5aec76..4d20027 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -552,6 +552,53 @@
return false;
 }

+/* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
+private function f_pcuif_tx_data_ind(octetstring data, int16_t lqual_cb := 0)
+runs on RAW_PCU_Test_CT {
+
+   BTS.send(ts_PCUIF_DATA_IND(bts_nr := 0, trx_nr := 0, ts_nr := 7, 
block_nr := 0,
+  sapi := PCU_IF_SAPI_PDTCH, data := data,
+  fn := 0, arfcn := 871, lqual_cb := 
lqual_cb));
+   BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_SENT));
+}
+
+/* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */
+private function f_pcuif_rx_data_req(out PCUIF_Message pcu_msg)
+runs on RAW_PCU_Test_CT {
+   BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+ sapi := PCU_IF_SAPI_PDTCH, fn := 0,
+ arfcn := 871, block_nr := 0));
+   BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+ sapi := PCU_IF_SAPI_PDTCH)) -> value 
pcu_msg;
+}
+
+private function f_tx_rlcmac_ul_block(template (value) RlcmacUlBlock ul_data, 
int16_t lqual_cb := 0)
+runs on RAW_PCU_Test_CT {
+   var octetstring data;
+   /* Encode the payload of DATA.ind */
+   data := enc_RlcmacUlBlock(valueof(ul_data));
+   data := f_pad_oct(data, 23, '00'O); /* CS-1 */
+
+   /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
+   f_pcuif_tx_data_ind(data, lqual_cb);
+}
+
+private function f_rx_rlcmac_dl_block(out RlcmacDlBlock dl_block)
+runs on RAW_PCU_Test_CT {
+   var PCUIF_Message pcu_msg;
+   f_pcuif_rx_data_req(pcu_msg);
+   dl_block := dec_RlcmacDlBlock(pcu_msg.u.data_req.data);
+}
+
+private function f_rx_rlcmac_dl_block_exp_ack_nack(out RlcmacDlBlock dl_block)
+runs on RAW_PCU_Test_CT {
+   f_rx_rlcmac_dl_block(dl_block);
+   if (not match(dl_block, tr_RLCMAC_ACK_NACK(ul_tfi := ?, tlli := ?))) {
+   setverdict(fail, "Failed to match Packet Uplink ACK / NACK");
+   mtc.stop;
+   }
+}
+
 testcase TC_pcuif_suspend() runs on RAW_PCU_Test_CT {
var octetstring ra_id := 
enc_RoutingAreaIdentification(mp_gb_cfg.cell_id.ra_id);
var GprsTlli tlli := ''O;
@@ -851,31 +898,15 @@
ul_data.data.mac_hdr.countdown := (15 - i);
ul_data.data.blocks := { 
valueof(t_RLCMAC_LLCBLOCK(f_rnd_octstring(10))) };

-   /* Encode the payload of DATA.ind */
-   data := enc_RlcmacUlBlock(valueof(ul_data));
-   data := f_pad_oct(data, 23, '00'O); /* CS-1 */
-
/* Link quality in dB and our CS1-4 expectations */
var integer lqual := i * 2;

/* Enqueue DATA.ind (both TDMA frame and block numbers to be 
patched) */
log("Sending DATA.ind with link quality (dB): ", lqual);
-   BTS.send(ts_PCUIF_DATA_IND(bts_nr := 0, trx_nr := 0, ts_nr := 
7, block_nr := 0,
-  sapi := PCU_IF_SAPI_PDTCH, data := 
data,
-  fn := 0, arfcn := 871, lqual_cb := 
lqual * 10));
-   BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_SENT));
+   f_tx_rlcmac_ul_block(ul_data, lqual * 10);

/* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */
-   BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
- sapi := PCU_IF_SAPI_PDTCH, fn := 0,
- arfcn := 871, block_nr := 0));
-   BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr 
:= 7,
- sapi := PCU_IF_SAPI_PDTCH)) -> 
value pcu_msg;
-   dl_block := dec_RlcmacDlBlock(pcu_msg.u.data_req.data);
-   if (not match(dl_block, tr_RLCMAC_ACK_NACK(ul_tfi := ?, tlli := 
?))) {
-   setverdict(fail, "Failed to match Packet Uplink ACK / 
NACK");
-   mtc.stop;
-   }
+   f_rx_rlcmac_dl_block_exp_ack_nack(dl_block);

log("Rx Packet Uplink ACK / NACK with Channel Coding Command: ",

Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce some function helpers

2019-10-07 Thread osmith
osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664 )

Change subject: pcu: Introduce some function helpers
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664
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: I8608fac4375153d5020df5d05026513a7fe931d6
Gerrit-Change-Number: 15664
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 11:39:20 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce some function helpers

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

Change subject: pcu: Introduce some function helpers
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664
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: I8608fac4375153d5020df5d05026513a7fe931d6
Gerrit-Change-Number: 15664
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 10:21:41 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce some function helpers

2019-10-03 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664 )

Change subject: pcu: Introduce some function helpers
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/15664/1/pcu/PCU_Tests_RAW.ttcn
File pcu/PCU_Tests_RAW.ttcn:

https://gerrit.osmocom.org/#/c/15664/1/pcu/PCU_Tests_RAW.ttcn@570
PS1, Line 570: f_pad_oct(data, 23, '00'O); /* CS-1 */
> We may want different coding schemes in the future, so the amount of padding 
> may vary. […]
I think it's better to add them whenever we need them in the commit requiring 
the param.



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664
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: I8608fac4375153d5020df5d05026513a7fe931d6
Gerrit-Change-Number: 15664
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 03 Oct 2019 19:35:31 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce some function helpers

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

Change subject: pcu: Introduce some function helpers
..


Patch Set 1: Code-Review+1

(1 comment)

Cool! I was also thinking about introducing some kind of abstraction functions.

https://gerrit.osmocom.org/#/c/15664/1/pcu/PCU_Tests_RAW.ttcn
File pcu/PCU_Tests_RAW.ttcn:

https://gerrit.osmocom.org/#/c/15664/1/pcu/PCU_Tests_RAW.ttcn@570
PS1, Line 570: f_pad_oct(data, 23, '00'O); /* CS-1 */
We may want different coding schemes in the future, so the amount of padding 
may vary. I recommend to add another parameter of type ChCodingCommand, which 
will define the amount of padding.



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664
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: I8608fac4375153d5020df5d05026513a7fe931d6
Gerrit-Change-Number: 15664
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 03 Oct 2019 19:22:39 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce some function helpers

2019-10-03 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664


Change subject: pcu: Introduce some function helpers
..

pcu: Introduce some function helpers

Change-Id: I8608fac4375153d5020df5d05026513a7fe931d6
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 44 insertions(+), 18 deletions(-)



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

diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index 6b45af2..90404d8 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -552,6 +552,48 @@
return false;
 }

+/* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
+private function f_tx_pcuif_data_ind(octetstring data, int16_t lqual_cb := 0)
+runs on RAW_PCU_Test_CT {
+
+   BTS.send(ts_PCUIF_DATA_IND(bts_nr := 0, trx_nr := 0, ts_nr := 7, 
block_nr := 0,
+  sapi := PCU_IF_SAPI_PDTCH, data := data,
+  fn := 0, arfcn := 871, lqual_cb := 
lqual_cb));
+   BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_SENT));
+}
+
+private function f_tx_pcuif_rlcmac_ul_block(template (value) RlcmacUlBlock 
ul_data, int16_t lqual_cb := 0)
+runs on RAW_PCU_Test_CT {
+   var octetstring data;
+   /* Encode the payload of DATA.ind */
+   data := enc_RlcmacUlBlock(valueof(ul_data));
+   data := f_pad_oct(data, 23, '00'O); /* CS-1 */
+
+   /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
+   f_tx_pcuif_data_ind(data, lqual_cb);
+}
+
+/* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */
+private function f_rx_pcuif_rlcmac_dl_block(out RlcmacDlBlock dl_block)
+runs on RAW_PCU_Test_CT {
+   var PCUIF_Message pcu_msg;
+   BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+ sapi := PCU_IF_SAPI_PDTCH, fn := 0,
+ arfcn := 871, block_nr := 0));
+   BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+ sapi := PCU_IF_SAPI_PDTCH)) -> value 
pcu_msg;
+   dl_block := dec_RlcmacDlBlock(pcu_msg.u.data_req.data);
+}
+
+private function f_rx_pcuif_rlcmac_dl_block_exp_ack_nack(out RlcmacDlBlock 
dl_block)
+runs on RAW_PCU_Test_CT {
+   f_rx_pcuif_rlcmac_dl_block(dl_block);
+   if (not match(dl_block, tr_RLCMAC_ACK_NACK(ul_tfi := ?, tlli := ?))) {
+   setverdict(fail, "Failed to match Packet Uplink ACK / NACK");
+   mtc.stop;
+   }
+}
+
 testcase TC_pcuif_suspend() runs on RAW_PCU_Test_CT {
var octetstring ra_id := 
enc_RoutingAreaIdentification(mp_gb_cfg.cell_id.ra_id);
var GprsTlli tlli := ''O;
@@ -661,31 +703,15 @@
ul_data.data.mac_hdr.countdown := (15 - i);
ul_data.data.blocks := { 
valueof(t_RLCMAC_LLCBLOCK(f_rnd_octstring(10))) };

-   /* Encode the payload of DATA.ind */
-   data := enc_RlcmacUlBlock(valueof(ul_data));
-   data := f_pad_oct(data, 23, '00'O); /* CS-1 */
-
/* Link quality in dB and our CS1-4 expectations */
var integer lqual := i * 2;

/* Enqueue DATA.ind (both TDMA frame and block numbers to be 
patched) */
log("Sending DATA.ind with link quality (dB): ", lqual);
-   BTS.send(ts_PCUIF_DATA_IND(bts_nr := 0, trx_nr := 0, ts_nr := 
7, block_nr := 0,
-  sapi := PCU_IF_SAPI_PDTCH, data := 
data,
-  fn := 0, arfcn := 871, lqual_cb := 
lqual * 10));
-   BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_SENT));
+   f_tx_pcuif_rlcmac_ul_block(ul_data, lqual * 10);

/* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */
-   BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
- sapi := PCU_IF_SAPI_PDTCH, fn := 0,
- arfcn := 871, block_nr := 0));
-   BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr 
:= 7,
- sapi := PCU_IF_SAPI_PDTCH)) -> 
value pcu_msg;
-   dl_block := dec_RlcmacDlBlock(pcu_msg.u.data_req.data);
-   if (not match(dl_block, tr_RLCMAC_ACK_NACK(ul_tfi := ?, tlli := 
?))) {
-   setverdict(fail, "Failed to match Packet Uplink ACK / 
NACK");
-   mtc.stop;
-   }
+   f_rx_pcuif_rlcmac_dl_block_exp_ack_nack(dl_block);

log("Rx Packet Uplink ACK / NACK with Channel Coding Command: ",
dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd);

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664
To unsubscribe, or for help writing mail filters, visit