pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38434?usp=email )

Change subject: sgsn: Test tx Rab Ass Resp with ITU X.213 IPv4 address format
......................................................................

sgsn: Test tx Rab Ass Resp with ITU X.213 IPv4 address format

Related: OS#6508
Related: SYS#7119
Change-Id: I38dd85f617600a974cbe8fd17597282eaf950a78
---
M sgsn/BSSGP_ConnHdlr.ttcn
M sgsn/SGSN_Tests.ttcn
M sgsn/SGSN_Tests_Iu.ttcn
M sgsn/expected-results.xml
4 files changed, 55 insertions(+), 9 deletions(-)

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




diff --git a/sgsn/BSSGP_ConnHdlr.ttcn b/sgsn/BSSGP_ConnHdlr.ttcn
index 121ac2d..e578748 100644
--- a/sgsn/BSSGP_ConnHdlr.ttcn
+++ b/sgsn/BSSGP_ConnHdlr.ttcn
@@ -102,7 +102,10 @@
        float t_guard,
        /* only in IuPS / RANAP case */
        SCCP_PAR_Address sccp_addr_local optional,
-       SCCP_PAR_Address sccp_addr_peer optional
+       SCCP_PAR_Address sccp_addr_peer optional,
+       /* Whether to encode HNBGW addr with ITU X.213 format when sending RAB 
Ass Resp: */
+       boolean ranap_use_itu_x213_addr_format,
+       octetstring ranap_itu_x213_addr_format_padding
 };

 function f_new_BSSGP_ConnHdlrPars(integer imsi_suffix,
@@ -125,7 +128,9 @@
                 net := net_pars,
                 t_guard := t_guard,
                 sccp_addr_local := omit,
-                sccp_addr_peer := omit
+                sccp_addr_peer := omit,
+                ranap_use_itu_x213_addr_format := false,
+                ranap_itu_x213_addr_format_padding := ''O
         }
         return valueof(pars);
 }
@@ -709,8 +714,15 @@
                        Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
                                log2str("Rx RAB Ass Req with TLI ", tli, " vs 
exp ", exp_tli));
                }
+
                var template (value) RAB_SetupOrModifiedList l;
-               l := ts_RAB_SMdL_ps(rab_id, oct2bit(apars.rnc_ip_u), 
apars.rnc_tei_u);
+               var bitstring tla_bits;
+               if (g_pars.ranap_use_itu_x213_addr_format) {
+                       tla_bits := 
oct2bit(enc_NSAP_Address(valueof(ts_NSAP_Address_IANA_BIN_IPv4(apars.rnc_ip_u, 
g_pars.ranap_itu_x213_addr_format_padding))));
+               } else {
+                       tla_bits := oct2bit(apars.rnc_ip_u);
+               }
+               l := ts_RAB_SMdL_ps(rab_id, tla_bits, apars.rnc_tei_u);
                BSSAP.send(ts_RANAP_RabAssResp(l));
        }
 }
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 1d6d924..4148c6c 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -448,18 +448,28 @@
        sccp_addr_peer := omit
 };

+function f_cell_ids_from_gb(GbInstances gb) return BssgpCellIds
+{
+       var BssgpCellIds cell_ids := {
+               gb[0].cfg.bvc[0].cell_id,
+               gb[1].cfg.bvc[0].cell_id,
+               gb[2].cfg.bvc[0].cell_id
+       }
+       return cell_ids;
+}
+
 /* helper function to create, connect and start a BSSGP_ConnHdlr component */
 function f_start_handler(bssgp_connhdlr_void_fn fn, charstring id, GbInstances 
gb, integer imsi_suffix,
                         float t_guard := 30.0, boolean expect_ciph := false)
 runs on test_CT return BSSGP_ConnHdlr {
        var BSSGP_ConnHdlrPars pars;
+       pars := f_new_BSSGP_ConnHdlrPars(imsi_suffix, f_cell_ids_from_gb(gb), 
t_NetPars(expect_ciph := expect_ciph), t_guard := t_guard);
+       return f_start_handler_pars(fn, id, gb, pars);
+}
+
+function f_start_handler_pars(bssgp_connhdlr_void_fn fn, charstring id, 
GbInstances gb, BSSGP_ConnHdlrPars pars)
+runs on test_CT return BSSGP_ConnHdlr {
        var BSSGP_ConnHdlr vc_conn;
-       var BssgpCellIds cell_ids := {
-                       gb[0].cfg.bvc[0].cell_id,
-                       gb[1].cfg.bvc[0].cell_id,
-                       gb[2].cfg.bvc[0].cell_id
-               }
-       pars := f_new_BSSGP_ConnHdlrPars(imsi_suffix, cell_ids, 
t_NetPars(expect_ciph := expect_ciph), t_guard := t_guard);
        if (g_iu_enable) {
                pars.sccp_addr_local := g_iu[0].ranap.sccp_addr_own;
                pars.sccp_addr_peer := g_iu[0].ranap.sccp_addr_peer;
diff --git a/sgsn/SGSN_Tests_Iu.ttcn b/sgsn/SGSN_Tests_Iu.ttcn
index f5339d4..cc9167a 100644
--- a/sgsn/SGSN_Tests_Iu.ttcn
+++ b/sgsn/SGSN_Tests_Iu.ttcn
@@ -146,6 +146,26 @@
        vc_conn.done;
        f_cleanup();
 }
+/* Same as TC_attach_pdp_act_user, but encoding HNBGW addr using ITU X.213
+format (IPv4, with padding to reach 20 bytes) in RAB Ass Resp. See OS#6508. */
+function f_TC_attach_pdp_act_user_addr_itu_x213_ipv4len(integer imsi_suffix, 
octetstring padding) runs on test_CT {
+       var BSSGP_ConnHdlr vc_conn;
+       var BSSGP_ConnHdlrPars pars;
+       f_init();
+       f_sleep(1.0);
+       pars := f_new_BSSGP_ConnHdlrPars(imsi_suffix, f_cell_ids_from_gb(g_gb));
+       pars.ranap_use_itu_x213_addr_format := true;
+       pars.ranap_itu_x213_addr_format_padding := padding;
+       vc_conn := f_start_handler_pars(refers(f_TC_attach_pdp_act_user), 
testcasename(), g_gb, pars);
+       vc_conn.done;
+       f_cleanup();
+}
+testcase TC_attach_pdp_act_user_addr_itu_x213_ipv4len7() runs on test_CT {
+       f_TC_attach_pdp_act_user_addr_itu_x213_ipv4len(1055, ''O)
+}
+testcase TC_attach_pdp_act_user_addr_itu_x213_ipv4len20() runs on test_CT {
+       f_TC_attach_pdp_act_user_addr_itu_x213_ipv4len(1056, 
'00000000000000000000000000'O)
+}

 /* Test UE going to PMM IDLE state after having activated the PDP context.
  * SGSN is expected to update the GGSN cancelling the Direct Tunnel feature. */
@@ -330,6 +350,8 @@
        execute( TC_iu_attach_geran_rau() );
        execute( TC_geran_attach_iu_rau() );
        execute( TC_attach_pdp_act_user() );
+       execute( TC_attach_pdp_act_user_addr_itu_x213_ipv4len7() );
+       execute( TC_attach_pdp_act_user_addr_itu_x213_ipv4len20() );
        execute( TC_attach_pdp_act_pmm_idle() );
        execute( TC_pmm_idle_rx_mt_data() );
        execute( TC_update_ctx_err_ind_from_ggsn() );
diff --git a/sgsn/expected-results.xml b/sgsn/expected-results.xml
index 40b6592..fbd31e6 100644
--- a/sgsn/expected-results.xml
+++ b/sgsn/expected-results.xml
@@ -94,6 +94,8 @@
   <testcase classname='SGSN_Tests_Iu' name='TC_iu_attach_geran_rau' 
time='MASKED'/>
   <testcase classname='SGSN_Tests_Iu' name='TC_geran_attach_iu_rau' 
time='MASKED'/>
   <testcase classname='SGSN_Tests_Iu' name='TC_attach_pdp_act_user' 
time='MASKED'/>
+  <testcase classname='SGSN_Tests_Iu' 
name='TC_attach_pdp_act_user_addr_itu_x213_ipv4len7' time='MASKED'/>
+  <testcase classname='SGSN_Tests_Iu' 
name='TC_attach_pdp_act_user_addr_itu_x213_ipv4len20' time='MASKED'/>
   <testcase classname='SGSN_Tests_Iu' name='TC_attach_pdp_act_pmm_idle' 
time='MASKED'/>
   <testcase classname='SGSN_Tests_Iu' 
name='TC_attach_pdp_act_pmm_idle_lost_pdp_status' time='MASKED'/>
   <testcase classname='SGSN_Tests_Iu' name='TC_pmm_idle_rx_mt_data' 
time='MASKED'/>

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38434?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I38dd85f617600a974cbe8fd17597282eaf950a78
Gerrit-Change-Number: 38434
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to