hnbgw: Introduce test TC_hnb_reregister_reuse_sctp_assoc

Change-Id: I7386bd4e786daf2688a68ab174a9d4f0b093a741
diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn
index f3079da..19df73e 100644
--- a/hnbgw/HNBGW_Tests.ttcn
+++ b/hnbgw/HNBGW_Tests.ttcn
@@ -688,6 +688,18 @@
 	f_shutdown_helper();
 }
 
+/* Drop HNBAP conn (HNBAP DEREG) and reconnect it (HNBAP REG) using same SCTP association.
+ * Related: OS#5676, SYS#6113 */
+testcase TC_hnb_reregister_reuse_sctp_assoc() runs on test_CT {
+	g_num_hnbs := 1;
+	f_init();
+	f_hnbap_register(0);
+	HNBAP[0].send(ts_HNBAP_HNBDe_Register(ts_HnbapCause(unspecified)));
+	f_hnbap_register(0);
+	f_verify_talloc_count(HNBGWVTY, {"struct hnb_context"}, expect_count := 1);
+	f_shutdown_helper();
+}
+
 /***********************************************************************
  * RUA / RANAP Testing
  ***********************************************************************/
@@ -1368,6 +1380,9 @@
 	execute(TC_ranap_cs_mo_disconnect());
 	execute(TC_ranap_ps_mo_disconnect());
 	execute(TC_ps_rab_assignment());
+
+	/* Run at the end since it makes osmo-hnbgw <= 1.3.0 crash: OS#5676 */
+	execute(TC_hnb_reregister_reuse_sctp_assoc());
 }
 
 }