Change in osmo-ttcn3-hacks[master]: DIAMETER: parametrize CEA template

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sun Apr 26 20:15:05 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17949 )

Change subject: DIAMETER: parametrize CEA template
......................................................................

DIAMETER: parametrize CEA template

So far, we hard-coded the Capabilities-Exchange-Answer for
HSS emulation.  As we want to emulate other DIAMETER network
elements, let's parametrize the template as well as the respective
parameters for the emulation component.

Change-Id: Ie30ff1bac40ab3dc6058587f0586b643ff2b0cb6
---
M library/DIAMETER_Emulation.ttcn
M library/DIAMETER_Templates.ttcn
M mme/MME_Tests.ttcn
3 files changed, 18 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/library/DIAMETER_Emulation.ttcn b/library/DIAMETER_Emulation.ttcn
index 6dd44b3..cff4d63 100644
--- a/library/DIAMETER_Emulation.ttcn
+++ b/library/DIAMETER_Emulation.ttcn
@@ -33,6 +33,7 @@
 import from DIAMETER_Templates all;
 import from Osmocom_Types all;
 import from IPL4asp_Types all;
+import from Native_Functions all;
 
 type hexstring IMSI;
 
@@ -94,7 +95,10 @@
 	HostName remote_ip,
 	PortNumber remote_sctp_port,
 	HostName local_ip,
-	PortNumber local_sctp_port
+	PortNumber local_sctp_port,
+	charstring origin_host,
+	charstring origin_realm,
+	uint32_t vendor_app_id
 }
 
 function tr_DIAMETER_RecvFrom_R(template PDU_DIAMETER msg)
@@ -312,7 +316,8 @@
 		/* handle CER/CEA handshake */
 		[] DIAMETER.receive(tr_DIAMETER_RecvFrom_R(tr_DIAMETER_R(cmd_code := Capabilities_Exchange))) -> value mrf {
 			var template (value) PDU_DIAMETER resp;
-			resp := ts_DIA_CEA(mrf.msg.hop_by_hop_id, mrf.msg.end_to_end_id);
+			resp := ts_DIA_CEA(mrf.msg.hop_by_hop_id, mrf.msg.end_to_end_id, p.origin_host,
+					   p.origin_realm, f_inet_addr(p.local_ip), p.vendor_app_id);
 			DIAMETER.send(t_DIAMETER_Send(g_diameter_conn_id, resp));
 			}
 
diff --git a/library/DIAMETER_Templates.ttcn b/library/DIAMETER_Templates.ttcn
index 11746eb..450e013 100644
--- a/library/DIAMETER_Templates.ttcn
+++ b/library/DIAMETER_Templates.ttcn
@@ -783,13 +783,15 @@
 
 /* 5.3.2 Capabilities Exchange Answer */
 template (value) PDU_DIAMETER
-ts_DIA_CEA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id)
+ts_DIA_CEA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
+	   template (value) charstring origin_host, template (value) charstring origin_realm,
+	   template (value) octetstring host_ip, uint32_t vendor_app_id)
 := ts_DIAMETER(flags:='00000000'B, cmd_code:=Capabilities_Exchange, hbh_id:=hbh_id, ete_id:=ete_id,
 	avps := {
 		ts_AVP_ResultCode(DIAMETER_SUCCESS),
-		ts_AVP_OriginHost("hss.localdomain"),
-		ts_AVP_OriginRealm("localdomain"),
-		ts_AVP_HostIpAddr('7E000004'O),
+		ts_AVP_OriginHost(origin_host),
+		ts_AVP_OriginRealm(origin_realm),
+		ts_AVP_HostIpAddr(host_ip),
 		ts_AVP_VendorId(vendor_id_3GPP),
 		ts_AVP_ProductName("TTCN-3 Testsuite"),
 		ts_AVP_OriginStateId('00000001'O),
@@ -798,7 +800,7 @@
 		ts_AVP_SuppVendorIdRaw(13019), /* ETSI */
 		ts_AVP_AuthAppId('FFFFFFFF'O),
 		ts_AVP_InbSecId('00000000'O),
-		ts_AVP_VendorSpecAppId(vendor_id_3GPP, c_DIAMETER_3GPP_S6_AID)
+		ts_AVP_VendorSpecAppId(vendor_id_3GPP, vendor_app_id)
 	});
 
 
diff --git a/mme/MME_Tests.ttcn b/mme/MME_Tests.ttcn
index da45485..0516809 100644
--- a/mme/MME_Tests.ttcn
+++ b/mme/MME_Tests.ttcn
@@ -219,7 +219,10 @@
 		remote_ip := mp_mme_ip,
 		remote_sctp_port := -1,
 		local_ip := mp_s6_local_ip,
-		local_sctp_port := mp_s6_local_port
+		local_sctp_port := mp_s6_local_port,
+		origin_host := "hss.localdomain",
+		origin_realm := "localdomain",
+		vendor_app_id := c_DIAMETER_3GPP_S6_AID
 	};
 	vc_DIAMETER := DIAMETER_Emulation_CT.create(id);
 	map(vc_DIAMETER:DIAMETER, system:DIAMETER_CODEC_PT);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17949
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: Ie30ff1bac40ab3dc6058587f0586b643ff2b0cb6
Gerrit-Change-Number: 17949
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200426/c2141a12/attachment.htm>


More information about the gerrit-log mailing list