daniel has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/29198 )


Change subject: hnbgw: Add test to check for duplicate hnb registrations
......................................................................

hnbgw: Add test to check for duplicate hnb registrations

Change-Id: Ib20d07ffabb91dfa82c212aaa363cafc7496bba8
Related: OS#6084
---
M hnbgw/HNBGW_Tests.ttcn
1 file changed, 33 insertions(+), 13 deletions(-)



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

diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn
index 81d9f1a..91b0d64 100644
--- a/hnbgw/HNBGW_Tests.ttcn
+++ b/hnbgw/HNBGW_Tests.ttcn
@@ -195,7 +195,7 @@
 }


-const integer NUM_HNB := 1;
+const integer NUM_HNB := 2;

 type record HnbConfig {
        LocationAreaIdentification lai,
@@ -290,13 +290,6 @@
 /* global initialization function */
 function f_init(charstring id := "HNBGW", float guard_timeout := 30.0) runs on 
test_CT {

-       g_hnb_cfg[0] := {
-               lai := {
-                       mcc_mnc := '00101'H,
-                       lac := 2342
-               },
-               sac := 55
-       }
        T_guard.start(guard_timeout);
        activate(as_Tguard());

@@ -306,6 +299,13 @@
                unitdata_cb := refers(IuhRanapUnitdataCallback)
        };
        for (var integer i := 0; i < NUM_HNB; i := i+1) {
+               g_hnb_cfg[i] := {
+                       lai := {
+                               mcc_mnc := '00101'H,
+                               lac := 2342 + i
+                       },
+                       sac := 55
+               };
                f_init_hnodeb(testcasename(), i, rua_ops);
        }

@@ -344,7 +344,7 @@
 /* helper function to start all of the simulated hNodeBs */
 function f_start_hnbs() runs on test_CT {
        for (var integer i:= 0; i < NUM_HNB; i := i+1) {
-               f_hnbap_register(i);
+               f_hnbap_register(i, i);
        }
 }

@@ -601,13 +601,13 @@
  ***********************************************************************/


-function f_hnbap_register(integer hnb_idx := 0) runs on test_CT
+function f_hnbap_register(integer hnb_idx := 0, integer cell_id := 0, boolean 
expect_reject := false) runs on test_CT
 {
        timer T := 2.0;

        HNBAP[hnb_idx].send(tr_HNBAP_HNBRegisterRequest(char2oct("TTCN3 
HNodeB"),
                                        '00F110'O,
-                                       int2bit(1 + hnb_idx, 28),
+                                       int2bit(1 + cell_id, 28),
                                        int2oct(2, 2),
                                        int2oct(3, 1),
                                        int2oct(4, 2)));
@@ -615,13 +615,24 @@
        T.start;
        alt {
        [] HNBAP[hnb_idx].receive(tr_HNBAP_HNBRegisterAccept(?)) {
-               setverdict(pass);
+               if (expect_reject) {
+                       setverdict(fail);
+               } else {
+                       setverdict(pass);
+               }
+       }
+       [] HNBAP[hnb_idx].receive(tr_HNBAP_HNBRegisterReject(?)) {
+               if (expect_reject) {
+                       setverdict(pass);
+               } else {
+                       setverdict(fail);
+               }
        }
        [] HNBAP[hnb_idx].receive(IUHEM_Event:?) {
                repeat;
        }
        [] T.timeout {
-               setverdict(fail, "Timeout waiting for HNB Register Accept");
+               setverdict(fail, "Timeout waiting for HNB Register response");
        }
        }
 }
@@ -632,6 +643,14 @@
        f_shutdown_helper();
 }

+testcase TC_hnb_register_duplicate() runs on test_CT {
+       f_init();
+       f_hnbap_register(0);
+       f_hnbap_register(1, 0, expect_reject := true);
+       f_verify_talloc_count(HNBGWVTY, {"struct hnb_context"}, expect_count := 
1);
+       f_shutdown_helper();
+}
+
 /***********************************************************************
  * RUA / RANAP Testing
  ***********************************************************************/
@@ -1144,6 +1163,7 @@

 control {
        execute(TC_hnb_register());
+       execute(TC_hnb_register_duplicate());
        execute(TC_ranap_cs_initial_ue());
        execute(TC_ranap_ps_initial_ue());
        execute(TC_ranap_cs_initial_ue_empty_cr());

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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ib20d07ffabb91dfa82c212aaa363cafc7496bba8
Gerrit-Change-Number: 29198
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <[email protected]>
Gerrit-MessageType: newchange

Reply via email to