Change in osmo-ttcn3-hacks[master]: support odd-length calling MSISDN in MSC tests

2018-11-18 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/11743 )

Change subject: support odd-length calling MSISDN in MSC tests
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/11743
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I34439c8750f588802a5403375e2a3d6e74dae70c
Gerrit-Change-Number: 11743
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Sun, 18 Nov 2018 20:27:51 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: support odd-length calling MSISDN in MSC tests

2018-11-18 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11743 )

Change subject: support odd-length calling MSISDN in MSC tests
..

support odd-length calling MSISDN in MSC tests

MSC tests were unable to match odd-length digit strings in
a CallingPartyBCD_Number template created by tr_Calling().
This happens because the raw encoder for CallingPartyBCD_Number
pads odd-length digits with 1-bits ('F'H). Do the same when
constructing such a template in our own code to ensure that
we'll match the actual data received.

Change-Id: I34439c8750f588802a5403375e2a3d6e74dae70c
Related: OS#2930
---
M library/L3_Templates.ttcn
M msc/MSC_Tests.ttcn
2 files changed, 12 insertions(+), 5 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 52d4a2a..e109fde 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -838,11 +838,20 @@
digits := digits
 }

+private function f_pad_digits(hexstring digits) return hexstring {
+   if (lengthof(digits) mod 2 != 0) {
+   /* Add trailing nibble of 1-bit padding, like the 
CallingPartyBCD_Number encoder would do.
+* Otherwise our template won't match the data received (see 
OS#2930). */
+   return digits & 'F'H;
+   }
+   return digits;
+}
+
 template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
elementIdentifier := '5C'O,
lengthIndicator := ?,
oct3 := ?,
-   digits := digits
+   digits := f_pad_digits(valueof(digits))
 }

 type integer SpeechVer;
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index c0cd9d3..2a6c034 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -1722,8 +1722,7 @@
 /* LU followed by MT call (including paging) */
 private function f_tc_lu_and_mt_call(charstring id, BSC_ConnHdlrPars pars) 
runs on BSC_ConnHdlr {
f_init_handler(pars);
-   //FIXME: odd digits var CallParameters cpars := 
valueof(t_CallParams('12345'H, 0));
-   var CallParameters cpars := valueof(t_CallParams('123456'H, 0));
+   var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
cpars.bss_rtp_port := 1110;
cpars.mgcp_connection_id_bss := '10004'H;
cpars.mgcp_connection_id_mss := '10005'H;
@@ -1845,8 +1844,7 @@
 /* LU followed by MT call (including paging) */
 private function f_tc_lu_and_mt_call_no_dlcx_resp(charstring id, 
BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
f_init_handler(pars);
-   //FIXME: odd digits var CallParameters cpars := 
valueof(t_CallParams('12345'H, 0));
-   var CallParameters cpars := valueof(t_CallParams('123456'H, 0));
+   var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
cpars.bss_rtp_port := 1110;
cpars.mgcp_connection_id_bss := '10004'H;
cpars.mgcp_connection_id_mss := '10005'H;

--
To view, visit https://gerrit.osmocom.org/11743
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I34439c8750f588802a5403375e2a3d6e74dae70c
Gerrit-Change-Number: 11743
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmo-ttcn3-hacks[master]: support odd-length calling MSISDN in MSC tests

2018-11-12 Thread Stefan Sperling
Stefan Sperling has posted comments on this change. ( 
https://gerrit.osmocom.org/11743 )

Change subject: support odd-length calling MSISDN in MSC tests
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/11743/1/library/L3_Templates.ttcn
File library/L3_Templates.ttcn:

https://gerrit.osmocom.org/#/c/11743/1/library/L3_Templates.ttcn@841
PS1, Line 841: private function f_pad_digits(hexstring digits) return hexstring 
{
> Could you please share this function somewhere? […]
Sure we can. Would it be enough to do that in a separate patch, if this one 
gets merged?



--
To view, visit https://gerrit.osmocom.org/11743
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I34439c8750f588802a5403375e2a3d6e74dae70c
Gerrit-Change-Number: 11743
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Mon, 12 Nov 2018 16:22:07 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ttcn3-hacks[master]: support odd-length calling MSISDN in MSC tests

2018-11-12 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/11743 )

Change subject: support odd-length calling MSISDN in MSC tests
..


Patch Set 1: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/#/c/11743/1/library/L3_Templates.ttcn
File library/L3_Templates.ttcn:

https://gerrit.osmocom.org/#/c/11743/1/library/L3_Templates.ttcn@841
PS1, Line 841: private function f_pad_digits(hexstring digits) return hexstring 
{
Could you please share this function somewhere?

I think we can use it at least in the current GSUP_Types.ttcn,
and in the upcoming SMS related patches...



--
To view, visit https://gerrit.osmocom.org/11743
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I34439c8750f588802a5403375e2a3d6e74dae70c
Gerrit-Change-Number: 11743
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Mon, 12 Nov 2018 16:19:19 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: support odd-length calling MSISDN in MSC tests

2018-11-12 Thread Stefan Sperling
Stefan Sperling has uploaded this change for review. ( 
https://gerrit.osmocom.org/11743


Change subject: support odd-length calling MSISDN in MSC tests
..

support odd-length calling MSISDN in MSC tests

MSC tests were unable to match odd-length digit strings in
a CallingPartyBCD_Number template created by tr_Calling().
This happens because the raw encoder for CallingPartyBCD_Number
pads odd-length digits with 1-bits ('F'H). Do the same when
constructing such a template in our own code to ensure that
we'll match the actual data received.

Change-Id: I34439c8750f588802a5403375e2a3d6e74dae70c
Related: OS#2930
---
M library/L3_Templates.ttcn
M msc/MSC_Tests.ttcn
2 files changed, 12 insertions(+), 5 deletions(-)



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

diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 52d4a2a..e109fde 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -838,11 +838,20 @@
digits := digits
 }

+private function f_pad_digits(hexstring digits) return hexstring {
+   if (lengthof(digits) mod 2 != 0) {
+   /* Add trailing nibble of 1-bit padding, like the 
CallingPartyBCD_Number encoder would do.
+* Otherwise our template won't match the data received (see 
OS#2930). */
+   return digits & 'F'H;
+   }
+   return digits;
+}
+
 template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
elementIdentifier := '5C'O,
lengthIndicator := ?,
oct3 := ?,
-   digits := digits
+   digits := f_pad_digits(valueof(digits))
 }

 type integer SpeechVer;
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index c0cd9d3..2a6c034 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -1722,8 +1722,7 @@
 /* LU followed by MT call (including paging) */
 private function f_tc_lu_and_mt_call(charstring id, BSC_ConnHdlrPars pars) 
runs on BSC_ConnHdlr {
f_init_handler(pars);
-   //FIXME: odd digits var CallParameters cpars := 
valueof(t_CallParams('12345'H, 0));
-   var CallParameters cpars := valueof(t_CallParams('123456'H, 0));
+   var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
cpars.bss_rtp_port := 1110;
cpars.mgcp_connection_id_bss := '10004'H;
cpars.mgcp_connection_id_mss := '10005'H;
@@ -1845,8 +1844,7 @@
 /* LU followed by MT call (including paging) */
 private function f_tc_lu_and_mt_call_no_dlcx_resp(charstring id, 
BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
f_init_handler(pars);
-   //FIXME: odd digits var CallParameters cpars := 
valueof(t_CallParams('12345'H, 0));
-   var CallParameters cpars := valueof(t_CallParams('123456'H, 0));
+   var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
cpars.bss_rtp_port := 1110;
cpars.mgcp_connection_id_bss := '10004'H;
cpars.mgcp_connection_id_mss := '10005'H;

--
To view, visit https://gerrit.osmocom.org/11743
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I34439c8750f588802a5403375e2a3d6e74dae70c
Gerrit-Change-Number: 11743
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling