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

Change subject: hnbgw: Test paging with PAge Area ID IE
......................................................................

hnbgw: Test paging with PAge Area ID IE

Change-Id: I313aadae08f187b413e894a93faa29ce771ef7fe
---
M hnbgw/HNBGW_Tests.ttcn
M hnbgw/expected-results.xml
M library/ranap/RANAP_Templates.ttcn
3 files changed, 170 insertions(+), 2 deletions(-)

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




diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn
index a261264..862bff9 100644
--- a/hnbgw/HNBGW_Tests.ttcn
+++ b/hnbgw/HNBGW_Tests.ttcn
@@ -2185,6 +2185,108 @@
        f_shutdown_helper();
 }

+/* Make sure that whichever MSC paged a subscriber will also get the Paging 
Response. Page by IMSI, which would be
+ * round-robined to another MSC, to make sure the Paging->Response relation is 
stronger than the NRI->MSC mapping. */
+friend function f_tc_mscpool_paging_imsi_lai_registered(charstring id) runs on 
ConnHdlr {
+       var hexstring imsi := '001010000000123'H;
+       var RANAP_IEs.CN_DomainIndicator domain_ind;
+       var template (value) RANAP_IEs.LAI lai := 
ts_RANAP_LAI(hex2oct(g_pars.hnb.lai.mcc_mnc),
+                                                              
int2oct(g_pars.hnb.lai.lac, 2));
+       var template (value) RANAP_IEs.PagingAreaID pag_area_id := 
ts_RANAP_PagingAreaID_LAI(lai);
+       if (g_pars.ps_domain) {
+               domain_ind := ps_domain;
+       } else {
+               domain_ind := cs_domain;
+       }
+       var template (value) RANAP_PDU paging := 
ts_RANAP_Paging_pag_area_id(domain_ind, imsi_hex2oct(imsi), pag_area_id);
+       BSSAP.send(ts_RANAP_UNITDATA_req(g_pars.sccp_addr_hnbgw, 
g_pars.sccp_addr_msc, paging));
+       /* TODO: Expect RUA ConnectionlessTransfer Paging (on subset of HNB).
+        * We could verify the Paging sent from osmo-hnbgw to RUA with some 
effort,
+        * but, this test does not care whether the Paging was forwarded to RUA 
or not, only that osmo-hnbgw *received*
+        * the Paging. In the CN pool decisions, osmo-hnbgw should match up 
Paging Response to an earlier Paging.
+        */
+
+       f_sleep(1.0);
+
+       /* Despite the round robin pointing at the second MSC ('roundrobin next 
msc 1'), the earlier Paging for the same IMSI
+        * causes this Paging Response to go to the first MSC ('msc 0'). */
+       f_perform_compl_l3(f_gen_one_compl_l3(PAGRESP, ts_MI_IMSI_LV(imsi)));
+       f_sleep(1.0);
+}
+
+/* Test CN sending a RANAP Paging Command with Paging Area ID IE (LAI) present 
requesting a registered HNB: */
+testcase TC_mscpool_paging_imsi_lai_registered() runs on test_CT {
+       f_init(nr_msc := 3);
+       f_sleep(1.0);
+
+       var boolean ps_domain := false;
+
+       /* Testing a Paging on the first MSC to get a Paging Response back to 
the first MSC. Set round robin to the
+        * second MSC to make sure we're getting the Paging logic, not a 
coincidental round robin match. */
+       f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0);
+
+       f_ctrs_cn_init(ps_domain := ps_domain);
+
+       var ConnHdlr vc_conn1;
+       var template (value) TestHdlrParams pars1 := f_TestHdlrParams(0, 
ps_domain := ps_domain, cn_nr := 0);
+       vc_conn1 := 
f_start_handler_with_pars(refers(f_tc_mscpool_paging_imsi_lai_registered), 
pars1);
+       vc_conn1.done;
+       f_ctrs_cn_expect(0, "cnpool:subscr:paged");
+       f_shutdown_helper();
+}
+
+/* Make sure that whichever MSC paged a subscriber will also get the Paging 
Response. Page by IMSI, which would be
+ * round-robined to another MSC, to make sure the Paging->Response relation is 
stronger than the NRI->MSC mapping. */
+friend function f_tc_mscpool_paging_imsi_rai_registered(charstring id) runs on 
ConnHdlr {
+       var hexstring imsi := '001010000000123'H;
+       var RANAP_IEs.CN_DomainIndicator domain_ind;
+       var template (value) RANAP_IEs.LAI lai := 
ts_RANAP_LAI(hex2oct(g_pars.hnb.lai.mcc_mnc),
+                                                              
int2oct(g_pars.hnb.lai.lac, 2));
+       var template (value) RANAP_IEs.RAI rai := ts_RANAP_RAI(lai,
+                                                              
int2oct(g_pars.hnb.rac, 1));
+       var template (value) RANAP_IEs.PagingAreaID pag_area_id := 
ts_RANAP_PagingAreaID_RAI(rai);
+       if (g_pars.ps_domain) {
+               domain_ind := ps_domain;
+       } else {
+               domain_ind := cs_domain;
+       }
+       var template (value) RANAP_PDU paging := 
ts_RANAP_Paging_pag_area_id(domain_ind, imsi_hex2oct(imsi), pag_area_id);
+       BSSAP.send(ts_RANAP_UNITDATA_req(g_pars.sccp_addr_hnbgw, 
g_pars.sccp_addr_msc, paging));
+       /* TODO: Expect RUA ConnectionlessTransfer Paging (on subset of HNB).
+        * We could verify the Paging sent from osmo-hnbgw to RUA with some 
effort,
+        * but, this test does not care whether the Paging was forwarded to RUA 
or not, only that osmo-hnbgw *received*
+        * the Paging. In the CN pool decisions, osmo-hnbgw should match up 
Paging Response to an earlier Paging.
+        */
+
+       f_sleep(1.0);
+
+       /* Despite the round robin pointing at the second MSC ('roundrobin next 
msc 1'), the earlier Paging for the same IMSI
+        * causes this Paging Response to go to the first MSC ('msc 0'). */
+       f_perform_compl_l3(f_gen_one_compl_l3(PAGRESP, ts_MI_IMSI_LV(imsi)));
+       f_sleep(1.0);
+}
+
+/* Test CN sending a RANAP Paging Command with Paging Area ID IE (LAI) present 
requesting a registered HNB: */
+testcase TC_mscpool_paging_imsi_rai_registered() runs on test_CT {
+       f_init(nr_msc := 3);
+       f_sleep(1.0);
+
+       var boolean ps_domain := true;
+
+       /* Testing a Paging on the first MSC to get a Paging Response back to 
the first MSC. Set round robin to the
+        * second MSC to make sure we're getting the Paging logic, not a 
coincidental round robin match. */
+       f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0);
+
+       f_ctrs_cn_init(ps_domain := ps_domain);
+
+       var ConnHdlr vc_conn1;
+       var template (value) TestHdlrParams pars1 := f_TestHdlrParams(0, 
ps_domain := ps_domain, cn_nr := 0);
+       vc_conn1 := 
f_start_handler_with_pars(refers(f_tc_mscpool_paging_imsi_rai_registered), 
pars1);
+       vc_conn1.done;
+       f_ctrs_cn_expect(0, "cnpool:subscr:paged");
+       f_shutdown_helper();
+}
+
 /* For round-robin, skip a CN link that has 'no allow-attach' set. */
 testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT {

@@ -2501,6 +2603,8 @@
        execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() );
        execute( TC_mscpool_paging_imsi() );
        execute( TC_mscpool_paging_tmsi() );
+       execute( TC_mscpool_paging_imsi_lai_registered() );
+       execute( TC_mscpool_paging_imsi_rai_registered() );
        execute( TC_mscpool_no_allow_attach_round_robin() );
        execute( TC_mscpool_no_allow_attach_valid_nri() );
        execute( TC_mscpool_sccp_n_pcstate_detaches_cnlink() );
diff --git a/hnbgw/expected-results.xml b/hnbgw/expected-results.xml
index 655db84..3fca542 100644
--- a/hnbgw/expected-results.xml
+++ b/hnbgw/expected-results.xml
@@ -43,6 +43,8 @@
   <testcase classname='HNBGW_Tests' 
name='TC_mscpool_LU_by_tmsi_from_other_PLMN' time='MASKED'/>
   <testcase classname='HNBGW_Tests' name='TC_mscpool_paging_imsi' 
time='MASKED'/>
   <testcase classname='HNBGW_Tests' name='TC_mscpool_paging_tmsi' 
time='MASKED'/>
+  <testcase classname='HNBGW_Tests' 
name='TC_mscpool_paging_imsi_lai_registered' time='MASKED'/>
+  <testcase classname='HNBGW_Tests' 
name='TC_mscpool_paging_imsi_rai_registered' time='MASKED'/>
   <testcase classname='HNBGW_Tests' 
name='TC_mscpool_no_allow_attach_round_robin' time='MASKED'/>
   <testcase classname='HNBGW_Tests' 
name='TC_mscpool_no_allow_attach_valid_nri' time='MASKED'/>
   <testcase classname='HNBGW_Tests' 
name='TC_mscpool_sccp_n_pcstate_detaches_cnlink' time='MASKED'/>
diff --git a/library/ranap/RANAP_Templates.ttcn 
b/library/ranap/RANAP_Templates.ttcn
index b09d23e..c328171 100644
--- a/library/ranap/RANAP_Templates.ttcn
+++ b/library/ranap/RANAP_Templates.ttcn
@@ -760,7 +760,8 @@
  
*****************************************************************************************************/

 template (value) RANAP_PDU
-ts_RANAP_Paging(template (value) CN_DomainIndicator dom, template (value) IMSI 
imsi,
+ts_RANAP_Paging(template (value) CN_DomainIndicator dom,
+               template (value) IMSI imsi,
                template (omit) Paging.protocolExtensions exts := omit) := {
        initiatingMessage := {
                procedureCode := id_Paging,
@@ -790,7 +791,8 @@
        }
 }
 template RANAP_PDU
-tr_RANAP_Paging(template CN_DomainIndicator dom, template IMSI imsi,
+tr_RANAP_Paging(template (present) CN_DomainIndicator dom,
+               template (present) IMSI imsi,
                template Paging.protocolExtensions exts := *) := {
        initiatingMessage := {
                procedureCode := id_Paging,
@@ -820,6 +822,7 @@
        }
 }

+
 template (value) TemporaryUE_ID ts_RANAP_TemporaryUE_ID_TMSI(octetstring tmsi) 
:= {
        tMSI := tmsi
 }
@@ -862,6 +865,65 @@
        }
 }

+template (value) LAI ts_RANAP_LAI(template (value) OCT3 pLMNidentity,
+                                 template (value) OCT2 lac) := {
+       pLMNidentity := pLMNidentity,
+       lAC := lac,
+       iE_Extensions := omit
+};
+
+template (value) RAI ts_RANAP_RAI(template (value) LAI lai,
+                                 template (value) OCT1 rac) := {
+       lAI := lai,
+       rAC := rac,
+       iE_Extensions := omit
+};
+
+template (value) PagingAreaID ts_RANAP_PagingAreaID_LAI(template (value) LAI 
lai) := {
+       lAI := lai
+};
+
+template (value) PagingAreaID ts_RANAP_PagingAreaID_RAI(template (value) RAI 
rai) := {
+       rAI := rai
+};
+
+template (value) RANAP_PDU
+ts_RANAP_Paging_pag_area_id(template (value) CN_DomainIndicator dom, template 
(value) IMSI imsi,
+                           template (value) PagingAreaID pag_area_id,
+                           template (omit) Paging.protocolExtensions exts := 
omit) := {
+       initiatingMessage := {
+               procedureCode := id_Paging,
+               criticality := ignore,
+               value_ := {
+                       paging := {
+                               protocolIEs := {
+                                       {
+                                               id := id_CN_DomainIndicator,
+                                               criticality := ignore,
+                                               value_ := {
+                                                       cN_DomainIndicator := 
dom
+                                               }
+                                       }, {
+                                               id := id_PermanentNAS_UE_ID,
+                                               criticality := ignore,
+                                               value_ := {
+                                                       permanentNAS_UE_ID := {
+                                                               iMSI := imsi
+                                                       }
+                                               }
+                                       }, {
+                                               id := id_PagingAreaID,
+                                               criticality := ignore,
+                                               value_ := {
+                                                       pagingAreaID := 
pag_area_id
+                                               }
+                                       }
+                               },
+                               protocolExtensions := exts
+                       }
+               }
+       }
+}

 
/*****************************************************************************************************
  * Common ID

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39997?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: I313aadae08f187b413e894a93faa29ce771ef7fe
Gerrit-Change-Number: 39997
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: lynxis lazus <lyn...@fe80.eu>
Gerrit-Reviewer: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>

Reply via email to