<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22831">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">sccp: Add Tests for SCMG SST procedure<br><br>The SST procedure can be used by any SCCP node to test the availability<br>of a remote SSN.  If the specified remote SSN is available at the<br>specified PC, a SCMG SSA is returned.  If not, there's a timeout.<br><br>Test for SSN=1 (SCMG), another non-SCMG SSN that exists, and for one<br>SSN that doesn't exist.<br><br>Change-Id: If3f5f3144c0ed83d0bda5953522a9d73287c8ba2<br>---<br>M deps/Makefile<br>M library/SCCP_Templates.ttcn<br>M sccp/SCCP_Tests_RAW.ttcn<br>3 files changed, 185 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/31/22831/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/deps/Makefile b/deps/Makefile</span><br><span>index c5fd338..c9cc53d 100644</span><br><span>--- a/deps/Makefile</span><br><span>+++ b/deps/Makefile</span><br><span>@@ -44,7 +44,6 @@</span><br><span>                        titan.TestPorts.UNIX_DOMAIN_SOCKETasp</span><br><span> </span><br><span> ECLIPSEGIT2_REPOS= titan.ProtocolEmulations.M3UA \</span><br><span style="color: hsl(0, 100%, 40%);">-                 titan.ProtocolEmulations.SCCP \</span><br><span>                      titan.ProtocolModules.GRE \</span><br><span>                  titan.ProtocolModules.M2PA \</span><br><span>                         titan.ProtocolModules.ROSE \</span><br><span>@@ -65,6 +64,7 @@</span><br><span> OSMOGITHUB_REPOS=   titan.TestPorts.SCTPasp \</span><br><span>                    titan.TestPorts.MTP3asp \</span><br><span>                    titan.TestPorts.UDPasp \</span><br><span style="color: hsl(120, 100%, 40%);">+                      titan.ProtocolEmulations.SCCP \</span><br><span>                      titan.ProtocolModules.BSSGP_v13.0.0</span><br><span> </span><br><span> OSMOGIT_REPOS=               titan.ProtocolModules.MAP \</span><br><span>@@ -80,7 +80,7 @@</span><br><span> # name of a local branch here (e.g. 'master').</span><br><span> titan.Libraries.TCCUsefulFunctions_commit= R.35.B-6-gb3687da</span><br><span> titan.ProtocolEmulations.M3UA_commit=              f086e78d74defa044d864f17adaad9433fedc961</span><br><span style="color: hsl(0, 100%, 40%);">-titan.ProtocolEmulations.SCCP_commit=           R.7.A-10-g2ca1566</span><br><span style="color: hsl(120, 100%, 40%);">+titan.ProtocolEmulations.SCCP_commit=                R.7.A-11-gd4b7a6d</span><br><span> titan.ProtocolModules.BSSAPP_v7.3.0_commit=        R.2.A-4-g20cfaf8</span><br><span> titan.ProtocolModules.BSSGP_v13.0.0_commit= e97d92a8b66bec399babea52f593771b76cb175a</span><br><span> titan.ProtocolModules.BSSMAP_commit=                master</span><br><span>diff --git a/library/SCCP_Templates.ttcn b/library/SCCP_Templates.ttcn</span><br><span>index ff4d745..9936dd0 100644</span><br><span>--- a/library/SCCP_Templates.ttcn</span><br><span>+++ b/library/SCCP_Templates.ttcn</span><br><span>@@ -215,5 +215,90 @@</span><br><span>       }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+private function f_pc_int2bit(template (present) integer pc)</span><br><span style="color: hsl(120, 100%, 40%);">+return template SCMG_param_AffectedPointCode {</span><br><span style="color: hsl(120, 100%, 40%);">+      if (istemplatekind(pc, "?")) {</span><br><span style="color: hsl(120, 100%, 40%);">+              return ?;</span><br><span style="color: hsl(120, 100%, 40%);">+     } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              return int2bit(valueof(pc), 16);</span><br><span style="color: hsl(120, 100%, 40%);">+      }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+template (value) PDU_SCMG_message ts_SCMG_SSA(template (value) integer ssn,</span><br><span style="color: hsl(120, 100%, 40%);">+                                         integer pc,</span><br><span style="color: hsl(120, 100%, 40%);">+                                           template (value) BIT2 smi := '00'B) := {</span><br><span style="color: hsl(120, 100%, 40%);">+        messageType := sSAallowed,</span><br><span style="color: hsl(120, 100%, 40%);">+    affectedSSN := ssn,</span><br><span style="color: hsl(120, 100%, 40%);">+   affectedPC := int2bit(valueof(pc), 16),</span><br><span style="color: hsl(120, 100%, 40%);">+       smi := {</span><br><span style="color: hsl(120, 100%, 40%);">+              smi := smi,</span><br><span style="color: hsl(120, 100%, 40%);">+           reserved := '000000'B</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+    congLevel := omit</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+template (present) PDU_SCMG_message tr_SCMG_SSA(template (present) integer ssn := ?,</span><br><span style="color: hsl(120, 100%, 40%);">+                                            template (present) integer pc := ?,</span><br><span style="color: hsl(120, 100%, 40%);">+                                           template (present) BIT2 smi := ?) := {</span><br><span style="color: hsl(120, 100%, 40%);">+        messageType := sSAallowed,</span><br><span style="color: hsl(120, 100%, 40%);">+    affectedSSN := ssn,</span><br><span style="color: hsl(120, 100%, 40%);">+   affectedPC := f_pc_int2bit(pc),</span><br><span style="color: hsl(120, 100%, 40%);">+       smi := {</span><br><span style="color: hsl(120, 100%, 40%);">+              smi := smi,</span><br><span style="color: hsl(120, 100%, 40%);">+           reserved := '000000'B</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+    congLevel := omit</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+template (value) PDU_SCMG_message ts_SCMG_SSP(template (value) integer ssn,</span><br><span style="color: hsl(120, 100%, 40%);">+                                         integer pc,</span><br><span style="color: hsl(120, 100%, 40%);">+                                           template (value) BIT2 smi := '00'B) := {</span><br><span style="color: hsl(120, 100%, 40%);">+        messageType := sSPprohib,</span><br><span style="color: hsl(120, 100%, 40%);">+     affectedSSN := ssn,</span><br><span style="color: hsl(120, 100%, 40%);">+   affectedPC := int2bit(valueof(pc), 16),</span><br><span style="color: hsl(120, 100%, 40%);">+       smi := {</span><br><span style="color: hsl(120, 100%, 40%);">+              smi := smi,</span><br><span style="color: hsl(120, 100%, 40%);">+           reserved := '000000'B</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+    congLevel := omit</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+template (present) PDU_SCMG_message tr_SCMG_SSP(template (present) integer ssn := ?,</span><br><span style="color: hsl(120, 100%, 40%);">+                                            template (present) integer pc := ?,</span><br><span style="color: hsl(120, 100%, 40%);">+                                           template (present) BIT2 smi := ?) := {</span><br><span style="color: hsl(120, 100%, 40%);">+        messageType := sSPprohib,</span><br><span style="color: hsl(120, 100%, 40%);">+     affectedSSN := ssn,</span><br><span style="color: hsl(120, 100%, 40%);">+   affectedPC := f_pc_int2bit(pc),</span><br><span style="color: hsl(120, 100%, 40%);">+       smi := {</span><br><span style="color: hsl(120, 100%, 40%);">+              smi := smi,</span><br><span style="color: hsl(120, 100%, 40%);">+           reserved := '000000'B</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+    congLevel := omit</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+template (value) PDU_SCMG_message ts_SCMG_SST(template (value) integer ssn,</span><br><span style="color: hsl(120, 100%, 40%);">+                                         integer pc,</span><br><span style="color: hsl(120, 100%, 40%);">+                                           template (value) BIT2 smi := '00'B) := {</span><br><span style="color: hsl(120, 100%, 40%);">+        messageType := sSTstaTest,</span><br><span style="color: hsl(120, 100%, 40%);">+    affectedSSN := ssn,</span><br><span style="color: hsl(120, 100%, 40%);">+   affectedPC := int2bit(valueof(pc), 16),</span><br><span style="color: hsl(120, 100%, 40%);">+       smi := {</span><br><span style="color: hsl(120, 100%, 40%);">+              smi := smi,</span><br><span style="color: hsl(120, 100%, 40%);">+           reserved := '000000'B</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+    congLevel := omit</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+template (present) PDU_SCMG_message tr_SCMG_SST(template (present) integer ssn := ?,</span><br><span style="color: hsl(120, 100%, 40%);">+                                            template (present) integer pc := ?,</span><br><span style="color: hsl(120, 100%, 40%);">+                                           template (present) BIT2 smi := ?) := {</span><br><span style="color: hsl(120, 100%, 40%);">+        messageType := sSTstaTest,</span><br><span style="color: hsl(120, 100%, 40%);">+    affectedSSN := ssn,</span><br><span style="color: hsl(120, 100%, 40%);">+   affectedPC := f_pc_int2bit(pc),</span><br><span style="color: hsl(120, 100%, 40%);">+       smi := {</span><br><span style="color: hsl(120, 100%, 40%);">+              smi := smi,</span><br><span style="color: hsl(120, 100%, 40%);">+           reserved := '000000'B</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+    congLevel := omit</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> </span><br><span> }</span><br><span>diff --git a/sccp/SCCP_Tests_RAW.ttcn b/sccp/SCCP_Tests_RAW.ttcn</span><br><span>index 7d44eb4..356fbb2 100644</span><br><span>--- a/sccp/SCCP_Tests_RAW.ttcn</span><br><span>+++ b/sccp/SCCP_Tests_RAW.ttcn</span><br><span>@@ -310,11 +310,109 @@</span><br><span>      }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+function f_scmg_xceive(SCCP_PAR_Address calling, SCCP_PAR_Address called,</span><br><span style="color: hsl(120, 100%, 40%);">+                template (value) PDU_SCMG_message tx,</span><br><span style="color: hsl(120, 100%, 40%);">+                 template (omit) PDU_SCMG_message rx_exp) runs on SCCP_Test_RAW_CT</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   var boolean exp_something := true;</span><br><span style="color: hsl(120, 100%, 40%);">+    timer T := 5.0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     if (istemplatekind(rx_exp, "omit")) {</span><br><span style="color: hsl(120, 100%, 40%);">+               exp_something := false;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   MTP3.clear;</span><br><span style="color: hsl(120, 100%, 40%);">+   f_send_sccp(ts_SCCP_UDT(calling, called, enc_PDU_SCMG_message(valueof(tx))));</span><br><span style="color: hsl(120, 100%, 40%);">+ T.start;</span><br><span style="color: hsl(120, 100%, 40%);">+      alt {</span><br><span style="color: hsl(120, 100%, 40%);">+ [exp_something] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(tr_SCCP_UDT(called, calling, decmatch rx_exp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+               setverdict(pass);</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span style="color: hsl(120, 100%, 40%);">+     [] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(tr_SCCP_UDT(called, calling, ?))) {</span><br><span style="color: hsl(120, 100%, 40%);">+          setverdict(fail, "Received unexpected SCCP waiting for ", rx_exp);</span><br><span style="color: hsl(120, 100%, 40%);">+          }</span><br><span style="color: hsl(120, 100%, 40%);">+     [] MTP3.receive {</span><br><span style="color: hsl(120, 100%, 40%);">+             setverdict(fail, "Received unexpected waiting for ", rx_exp);</span><br><span style="color: hsl(120, 100%, 40%);">+               }</span><br><span style="color: hsl(120, 100%, 40%);">+     [exp_something] T.timeout {</span><br><span style="color: hsl(120, 100%, 40%);">+           setverdict(fail, "Timeout waiting for ", rx_exp);</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span style="color: hsl(120, 100%, 40%);">+     [not exp_something] T.timeout {</span><br><span style="color: hsl(120, 100%, 40%);">+               setverdict(pass);</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Test is SST(SSN=1) returns SSA */</span><br><span style="color: hsl(120, 100%, 40%);">+testcase TC_scmg_sst_ssn1() runs on SCCP_Test_RAW_CT {</span><br><span style="color: hsl(120, 100%, 40%);">+        var SCCP_PAR_Address calling, called;</span><br><span style="color: hsl(120, 100%, 40%);">+ var template (value) PDU_SCMG_message tx;</span><br><span style="color: hsl(120, 100%, 40%);">+     var template (present) PDU_SCMG_message rx_exp;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     f_init_raw(mp_sccp_cfg[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+   f_sleep(1.0);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, 1,</span><br><span style="color: hsl(120, 100%, 40%);">+                                            mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));</span><br><span style="color: hsl(120, 100%, 40%);">+  calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, 1,</span><br><span style="color: hsl(120, 100%, 40%);">+                                            mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        tx := ts_SCMG_SST(1, mp_sccp_cfg[0].peer_pc);</span><br><span style="color: hsl(120, 100%, 40%);">+ rx_exp := ts_SCMG_SSA(1, mp_sccp_cfg[0].peer_pc);</span><br><span style="color: hsl(120, 100%, 40%);">+     f_scmg_xceive(calling, called, tx, rx_exp);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Test is SST(SSN=valid) returns SSA */</span><br><span style="color: hsl(120, 100%, 40%);">+testcase TC_scmg_sst_ssn_valid() runs on SCCP_Test_RAW_CT {</span><br><span style="color: hsl(120, 100%, 40%);">+       var SCCP_PAR_Address calling, called;</span><br><span style="color: hsl(120, 100%, 40%);">+ var template (value) PDU_SCMG_message tx;</span><br><span style="color: hsl(120, 100%, 40%);">+     var template (present) PDU_SCMG_message rx_exp;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     f_init_raw(mp_sccp_cfg[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+   f_sleep(1.0);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, 1,</span><br><span style="color: hsl(120, 100%, 40%);">+                                            mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));</span><br><span style="color: hsl(120, 100%, 40%);">+  calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, 1,</span><br><span style="color: hsl(120, 100%, 40%);">+                                            mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        tx := ts_SCMG_SST(mp_sccp_cfg[0].peer_ssn, mp_sccp_cfg[0].peer_pc);</span><br><span style="color: hsl(120, 100%, 40%);">+   rx_exp := ts_SCMG_SSA(mp_sccp_cfg[0].peer_ssn, mp_sccp_cfg[0].peer_pc);</span><br><span style="color: hsl(120, 100%, 40%);">+       f_scmg_xceive(calling, called, tx, rx_exp);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Test is SST(SSN=invalid) returns nothing */</span><br><span style="color: hsl(120, 100%, 40%);">+testcase TC_scmg_sst_ssn_invalid() runs on SCCP_Test_RAW_CT {</span><br><span style="color: hsl(120, 100%, 40%);">+     var SCCP_PAR_Address calling, called;</span><br><span style="color: hsl(120, 100%, 40%);">+ var template (value) PDU_SCMG_message tx;</span><br><span style="color: hsl(120, 100%, 40%);">+     var template (omit) PDU_SCMG_message rx_exp;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        f_init_raw(mp_sccp_cfg[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+   f_sleep(1.0);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, 1,</span><br><span style="color: hsl(120, 100%, 40%);">+                                            mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));</span><br><span style="color: hsl(120, 100%, 40%);">+  calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, 1,</span><br><span style="color: hsl(120, 100%, 40%);">+                                            mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        tx := ts_SCMG_SST(123, mp_sccp_cfg[0].peer_pc);</span><br><span style="color: hsl(120, 100%, 40%);">+       rx_exp := omit;</span><br><span style="color: hsl(120, 100%, 40%);">+       f_scmg_xceive(calling, called, tx, rx_exp);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> control {</span><br><span>    execute( TC_cr_cc() );</span><br><span>       execute( TC_udt_without_cr_cc() );</span><br><span>   execute( TC_tiar_timeout() );</span><br><span>        execute( TC_it_avoids_tiar() );</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     execute( TC_scmg_sst_ssn1() );</span><br><span style="color: hsl(120, 100%, 40%);">+        execute( TC_scmg_sst_ssn_valid() );</span><br><span style="color: hsl(120, 100%, 40%);">+   execute( TC_scmg_sst_ssn_invalid() );</span><br><span> }</span><br><span> </span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22831">change 22831</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22831"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ttcn3-hacks </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: If3f5f3144c0ed83d0bda5953522a9d73287c8ba2 </div>
<div style="display:none"> Gerrit-Change-Number: 22831 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>