epdg: Introduce test TC_hss_initiated_deregister_new_server_assigned

Related: OS#6042
Change-Id: Ia5bf7708d11421710f3a88669d94c4f01060cdd6
diff --git a/library/DIAMETER_ts29_273_Templates.ttcn b/library/DIAMETER_ts29_273_Templates.ttcn
index f0ac442..0a42d6a 100644
--- a/library/DIAMETER_ts29_273_Templates.ttcn
+++ b/library/DIAMETER_ts29_273_Templates.ttcn
@@ -15,6 +15,7 @@
 import from DIAMETER_Types all;
 import from DIAMETER_Templates all;
 import from DIAMETER_rfc5447_Templates all;
+import from DIAMETER_ts29_229_Templates all;
 import from DIAMETER_ts29_272_Templates all;
 import from Osmocom_Types all;
 import from Misc_Helpers all;
@@ -269,6 +270,61 @@
 			 */
 	});
 
+/* Registration-Termination-Request (RTR) , 8.2.2.4 Network Initiated De-Registration by HSS Procedure */
+template (value) PDU_DIAMETER
+ts_DIA_SWx_RTR(template (value) hexstring imsi,
+	       template (value) CxDx_3GPP_Reason_Code reason_code := PERMANENT_TERMINATION,
+               template (value) octetstring reason_info := ''O,
+	       template (value) uint32_t vendor_app_id := c_DIAMETER_3GPP_SWx_AID,
+	       template (value) octetstring sess_id := c_def_sess_id,
+	       template (value) charstring orig_host := "hss.localdomain",
+	       template (value) charstring orig_realm := "localdomain",
+	       template (value) charstring dest_host := "aaa.localdomain",
+	       template (value) charstring dest_realm := "localdomain",
+	       template (value) UINT32 hbh_id := '00000000'O,
+	       template (value) UINT32 ete_id := '00000000'O) :=
+	ts_DIAMETER(flags := '11000000'B,
+		    cmd_code := Registration_Termination,
+		    app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
+		    hbh_id := hbh_id,
+		    ete_id := ete_id,
+		    avps := {
+			ts_AVP_SessionId(sess_id),
+			ts_AVP_VendorSpecAppId(vendor_id_3GPP, valueof(vendor_app_id)),
+			ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
+			ts_AVP_OriginHost(orig_host),
+			ts_AVP_OriginRealm(orig_realm),
+			ts_AVP_DestinationHost(dest_host),
+			ts_AVP_DestinationRealm(dest_realm),
+			ts_AVP_UserNameImsi(imsi),
+			ts_AVP_CxDx_3GPP_Deregistration_Reason(reason_code, reason_info)
+			/* TODO:
+			 * *[ Supported-Features ]
+			 */
+	});
+
+template (present) PDU_DIAMETER
+tr_DIA_SWx_RTA(template (present) GenericAVP tmpl_result := ?,
+	       template (present) octetstring sess_id := ?,
+	       template (present) charstring orig_host :=  ?,
+	       template (present) charstring orig_realm := ?,
+	       template (present) charstring dest_host := ?,
+	       template (present) charstring dest_realm := ?,
+	       template (present) UINT32 hbh_id := ?,
+	       template (present) UINT32 ete_id := ?) :=
+	tr_DIAMETER(flags := '0???????'B,
+		    cmd_code := Registration_Termination,
+		    app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
+		    hbh_id := hbh_id, ete_id := ete_id,
+		    avps := superset(
+			tr_AVP_SessionId(sess_id),
+			tr_AVP_VendorSpecAppId(?, ?),
+			tmpl_result,
+			tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
+			tr_AVP_OriginHost(orig_host),
+			tr_AVP_OriginRealm(orig_realm)
+	));
+
 /*******************************
  * S6b 3GPP TS 29.273 section 9
  *******************************/