[MERGED] osmo-ttcn3-hacks[master]: msc: Initial SMS testing (MO + MT SMS, successful case, no S...

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: msc: Initial SMS testing (MO + MT SMS, successful case, no SMPP)
..


msc: Initial SMS testing (MO + MT SMS, successful case, no SMPP)

Change-Id: I707330454ffab87daebf22ba83e6ba2873996424
---
M library/L3_Templates.ttcn
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
3 files changed, 502 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 3203b0e..3304662 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -2,7 +2,7 @@
 
 /* L3 Templates, building on top of MobileL3*_Types from Ericsson.
  *
- * (C) 2017 by Harald Welte 
+ * (C) 2017-2018 by Harald Welte 
  * All rights reserved.
  *
  * Released under the terms of GNU General Public License, Version 2 or
@@ -17,7 +17,7 @@
 import from MobileL3_RRM_Types all;
 import from MobileL3_CC_Types all;
 import from MobileL3_GMM_SM_Types all;
-//import from MobileL3_SMS_Types all;
+import from MobileL3_SMS_Types all;
 
 /* TS 24.007 Table 11.3 TI Flag */
 const BIT1 c_TIF_ORIG := '0'B;
@@ -2168,4 +2168,284 @@
with { extension "prototype(convert) encode(RAW)" };
 
 
+
+/* SMS TPDU Layer */
+
+template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template 
(value) TP_DA dst_addr,
+ template (value) OCT1 pid, template 
(value) OCT1 dcs,
+ integer length_ind, octetstring 
user_data) := {
+   sMS_SUBMIT := {
+   tP_MTI := '01'B,/* SUBMIT */
+   tP_RD := '1'B,  /* reject duplicates */
+   tP_VPF := '00'B,/* not present */
+   tP_SRR := '0'B, /* no status report requested */
+   tP_UDHI := '0'B,/* no user data header in UD */
+   tP_RP := '0'B,  /* no reply path */
+   tP_MR := msg_ref,
+   tP_DA := dst_addr,
+   tP_PID := pid,
+   tP_DCS := dcs,
+   tP_VP := omit,
+   tP_UDL_UD := {
+   tP_LengthIndicator := length_ind,
+   tP_UD := user_data
+   }
+   }
+}
+
+template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
+   template octetstring user_data := ?,
+   template OCT1 pid := ?, template OCT1 dcs 
:= ?,
+   template BIT1 mms := ?
+   ) := {
+   sMS_DELIVER := {
+   tP_MTI := '00'B,/* DELIVER */
+   tP_MMS := mms,  /* more messages to send */
+   tP_LP := ?, /* ?!? */
+   tP_Spare := '0'B,
+   tP_SRI := '0'B, /* status report indication */
+   tP_UDHI := '0'B,/* no user data header in UD */
+   tP_RP := '0'B,  /* no reply path */
+   tP_OA := src_addr,
+   tP_PID := pid,
+   tP_DCS := dcs,
+   tP_SCTS := ?,
+   tP_UDL_UD := {
+   tP_LengthIndicator := ?,
+   tP_UD := user_data
+   }
+   }
+}
+
+/* RP Layer */
+
+private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits 
rp_orig)
+return RP_OriginatorAddressLV {
+   var RP_OriginatorAddressLV ret;
+   if (istemplatekind(rp_orig, "omit")) {
+   ret := { 0, omit };
+   } else {
+   ret := { 0, valueof(rp_orig) };
+   }
+   return ret;
+}
+
+private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits 
rp_dst)
+return RP_DestinationAddressLV {
+   var RP_DestinationAddressLV ret;
+   if (istemplatekind(rp_dst, "omit")) {
+   ret := { 0, omit };
+   } else {
+   ret := { 0, valueof(rp_dst) };
+   }
+   return ret;
+}
+
+template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
+   template (omit) 
RP_NumberingPlan_and_NumberDigits rp_orig,
+   template (omit) 
RP_NumberingPlan_and_NumberDigits rp_dst,
+   template (value) 
TPDU_RP_DATA_MS_SGSN tpdu) := {
+   rP_DATA_MS_SGSN := {
+   rP_MTI := '000'B,
+   rP_Spare := '0'B,
+   rP_MessageReference := msg_ref,
+   rP_OriginatorAddress := ts_RpOrig(rp_orig),
+   rP_DestinationAddress := ts_RpDst(rp_dst),
+   rP_User_Data := {
+   rP_LengthIndicator := 0, /* overwritten */
+   rP_TPDU := tpdu
+   }
+   }
+}
+
+template 

osmo-ttcn3-hacks[master]: msc: Initial SMS testing (MO + MT SMS, successful case, no S...

2018-04-09 Thread Harald Welte

Patch Set 3: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/7698
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I707330454ffab87daebf22ba83e6ba2873996424
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: msc: Initial SMS testing (MO + MT SMS, successful case, no S...

2018-04-09 Thread Harald Welte

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

msc: Initial SMS testing (MO + MT SMS, successful case, no SMPP)

Change-Id: I707330454ffab87daebf22ba83e6ba2873996424
---
M library/L3_Templates.ttcn
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
3 files changed, 502 insertions(+), 3 deletions(-)


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

diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 3203b0e..3304662 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -2,7 +2,7 @@
 
 /* L3 Templates, building on top of MobileL3*_Types from Ericsson.
  *
- * (C) 2017 by Harald Welte 
+ * (C) 2017-2018 by Harald Welte 
  * All rights reserved.
  *
  * Released under the terms of GNU General Public License, Version 2 or
@@ -17,7 +17,7 @@
 import from MobileL3_RRM_Types all;
 import from MobileL3_CC_Types all;
 import from MobileL3_GMM_SM_Types all;
-//import from MobileL3_SMS_Types all;
+import from MobileL3_SMS_Types all;
 
 /* TS 24.007 Table 11.3 TI Flag */
 const BIT1 c_TIF_ORIG := '0'B;
@@ -2168,4 +2168,284 @@
with { extension "prototype(convert) encode(RAW)" };
 
 
+
+/* SMS TPDU Layer */
+
+template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template 
(value) TP_DA dst_addr,
+ template (value) OCT1 pid, template 
(value) OCT1 dcs,
+ integer length_ind, octetstring 
user_data) := {
+   sMS_SUBMIT := {
+   tP_MTI := '01'B,/* SUBMIT */
+   tP_RD := '1'B,  /* reject duplicates */
+   tP_VPF := '00'B,/* not present */
+   tP_SRR := '0'B, /* no status report requested */
+   tP_UDHI := '0'B,/* no user data header in UD */
+   tP_RP := '0'B,  /* no reply path */
+   tP_MR := msg_ref,
+   tP_DA := dst_addr,
+   tP_PID := pid,
+   tP_DCS := dcs,
+   tP_VP := omit,
+   tP_UDL_UD := {
+   tP_LengthIndicator := length_ind,
+   tP_UD := user_data
+   }
+   }
+}
+
+template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
+   template octetstring user_data := ?,
+   template OCT1 pid := ?, template OCT1 dcs 
:= ?,
+   template BIT1 mms := ?
+   ) := {
+   sMS_DELIVER := {
+   tP_MTI := '00'B,/* DELIVER */
+   tP_MMS := mms,  /* more messages to send */
+   tP_LP := ?, /* ?!? */
+   tP_Spare := '0'B,
+   tP_SRI := '0'B, /* status report indication */
+   tP_UDHI := '0'B,/* no user data header in UD */
+   tP_RP := '0'B,  /* no reply path */
+   tP_OA := src_addr,
+   tP_PID := pid,
+   tP_DCS := dcs,
+   tP_SCTS := ?,
+   tP_UDL_UD := {
+   tP_LengthIndicator := ?,
+   tP_UD := user_data
+   }
+   }
+}
+
+/* RP Layer */
+
+private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits 
rp_orig)
+return RP_OriginatorAddressLV {
+   var RP_OriginatorAddressLV ret;
+   if (istemplatekind(rp_orig, "omit")) {
+   ret := { 0, omit };
+   } else {
+   ret := { 0, valueof(rp_orig) };
+   }
+   return ret;
+}
+
+private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits 
rp_dst)
+return RP_DestinationAddressLV {
+   var RP_DestinationAddressLV ret;
+   if (istemplatekind(rp_dst, "omit")) {
+   ret := { 0, omit };
+   } else {
+   ret := { 0, valueof(rp_dst) };
+   }
+   return ret;
+}
+
+template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
+   template (omit) 
RP_NumberingPlan_and_NumberDigits rp_orig,
+   template (omit) 
RP_NumberingPlan_and_NumberDigits rp_dst,
+   template (value) 
TPDU_RP_DATA_MS_SGSN tpdu) := {
+   rP_DATA_MS_SGSN := {
+   rP_MTI := '000'B,
+   rP_Spare := '0'B,
+   rP_MessageReference := msg_ref,
+   rP_OriginatorAddress := ts_RpOrig(rp_orig),
+   rP_DestinationAddress := ts_RpDst(rp_dst),
+   rP_User_Data := {
+   rP_LengthIndicator := 0, /* overwritten */
+   rP_TPDU := tpdu
+   }
+   }
+}
+
+template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
+   template RP_NumberingPlan_and_NumberDigits 
rp_orig,
+