pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34872?usp=email )
Change subject: library/DIAMETER: Split TS 29.273 templates into its own file ......................................................................
library/DIAMETER: Split TS 29.273 templates into its own file
The templates are added in a new separate file with the aim of starting splitting the tons of AVPs originating from different specs in order to be able to quickly identify them and avoid confusion.
Change-Id: I77f917404dd70559b2b2cc62199ed70289ab0825 --- M epdg/EPDG_Tests.ttcn M epdg/gen_links.sh M library/DIAMETER_Templates.ttcn A library/DIAMETER_ts29_273_Templates.ttcn 4 files changed, 264 insertions(+), 228 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/72/34872/1
diff --git a/epdg/EPDG_Tests.ttcn b/epdg/EPDG_Tests.ttcn index 76fd45e..396ca0e 100644 --- a/epdg/EPDG_Tests.ttcn +++ b/epdg/EPDG_Tests.ttcn @@ -12,6 +12,7 @@
import from DIAMETER_Types all; import from DIAMETER_Templates all; +import from DIAMETER_ts29_273_Templates all; import from DIAMETER_Emulation all;
import from GTPv2_Types all; diff --git a/epdg/gen_links.sh b/epdg/gen_links.sh index 326d82e..b464203 100755 --- a/epdg/gen_links.sh +++ b/epdg/gen_links.sh @@ -41,7 +41,8 @@ FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc " FILES+="Osmocom_CTRL_Types.ttcn " FILES+="L3_Common.ttcn " -FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc DIAMETER_Emulation.ttcn DIAMETER_Templates.ttcn " +FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc DIAMETER_Emulation.ttcn " +FILES+="DIAMETER_Templates.ttcn DIAMETER_ts29_273_Templates.ttcn " FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp " FILES+="GSUP_Types.ttcn GSUP_Emulation.ttcn " diff --git a/library/DIAMETER_Templates.ttcn b/library/DIAMETER_Templates.ttcn index f46bf37..3b4590e 100644 --- a/library/DIAMETER_Templates.ttcn +++ b/library/DIAMETER_Templates.ttcn @@ -125,10 +125,6 @@ const uint32_t c_DIAMETER_3GPP_S6_AID := 16777251; const uint32_t c_DIAMETER_3GPP_S13_AID := 16777252; const uint32_t c_DIAMETER_3GPP_S7_AID := 16777308; -/* 3GPP TS 29.273 Section 8.2 */ -const uint32_t c_DIAMETER_3GPP_SWx_AID := 16777265; -/* 3GPP TS 29.273 Section 9 */ -const uint32_t c_DIAMETER_3GPP_S6b_AID := 16777272;
const octetstring c_def_sess_id := char2oct("ttcn3.session");
@@ -2306,227 +2302,4 @@ } }
-/******************************* - * SWx 3GPP TS 29.273 section 8 - *******************************/ - -/* SIP-Auth-Data-Item , 3GPP TS 29.273 8.2.3.9 */ -template (present) GenericAVP tr_AVP_3GPP_SIPAuthDataItem(template (present) uint32_t num := ?) := { - avp := { - avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Auth_Data_Item), - avp_data := { - avp_CxDx_3GPP_SIP_Auth_Data_Item := superset( - //tr_AVP_3GPP_SIPItemNumber(num), /* Optional */ - tr_AVP_3GPP_SIPAuthScheme(?)//, /* Optional */ - //tr_AVP_3GPP_SIPAuthenticate(?), /* Optional */ - //tr_AVP_3GPP_SIPAuthorization(?), /* Optional */ - //tr_AVP_3GPP_SIPAuthContext(?), /* Optional */ - //tr_AVP_3GPP_ConfidentialityKey(?), /* Optional */ - //tr_AVP_3GPP_IntegrityKey(?) /* Optional */ - /* TODO: - [ SIP-Digest-Authenticate ] - [ Framed-IP-Address ] - [ Framed-IPv6-Prefix ] - [ Framed-Interface-Id ] - [ Line-Identifier ] - *[AVP] - */ - ) - } - } -} -template (value) GenericAVP ts_AVP_3GPP_SIPAuthDataItem(uint32_t num, OCT16 rand, OCT16 ik, OCT16 ck, OCT16 autn, OCT14 auts) := { - avp := { - avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Auth_Data_Item), - avp_data := { - avp_CxDx_3GPP_SIP_Auth_Data_Item := { - ts_AVP_3GPP_SIPItemNumber(num), - ts_AVP_3GPP_SIPAuthScheme(char2oct("Digest-AKAv1-MD5")), - ts_AVP_3GPP_SIPAuthenticate(rand & autn), - ts_AVP_3GPP_SIPAuthorization(rand & auts), - ts_AVP_3GPP_SIPAuthContext(char2oct("foobar")), - ts_AVP_3GPP_ConfidentialityKey(ck), - ts_AVP_3GPP_IntegrityKey(ik) - /* TODO: - [ SIP-Digest-Authenticate ] - [ Framed-IP-Address ] - [ Framed-IPv6-Prefix ] - [ Framed-Interface-Id ] - [ Line-Identifier ] - *[AVP] - */ - } - } - } -} - -/* Multimedia-Auth-Request, 3GPP TS 29.273 8.2.2.1 Authentication Procedure */ -template (present) PDU_DIAMETER -tr_DIA_SWx_MAR(template (present) hexstring imsi := ?, - template (present) octetstring sess_id := ?, - template (present) charstring orig_host := ?, - template (present) charstring orig_realm := ?, - template (present) charstring dest_realm := ?, - template (present) UINT32 hbh_id := ?, - template (present) UINT32 ete_id := ?) := - tr_DIAMETER(flags := '1???????'B, - cmd_code := Multimedia_Auth, - 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(?, ?), - tr_AVP_AuthSessionState(NO_STATE_MAINTAINED), - tr_AVP_OriginHost(orig_host), - tr_AVP_OriginRealm(orig_realm), - tr_AVP_DestinationRealm(dest_realm), - tr_AVP_UserNameImsi(imsi), - tr_AVP_3GPP_SIPAuthDataItem(?), - tr_AVP_3GPP_SIPNumAuthDataItems(?) - )); - -/* Multimedia-Auth-Answer, 3GPP TS 29.273 8.2.2.1 Authentication Procedure */ -template (value) PDU_DIAMETER -ts_DIA_SWx_MAA(template (value) hexstring imsi, - template (value) GenericAVP sip_auth_data_item, - 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) UINT32 hbh_id := '00000000'O, - template (value) UINT32 ete_id := '00000000'O) := - ts_DIAMETER(flags := '01000000'B, - cmd_code := Multimedia_Auth, - 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_ResultCode(DIAMETER_SUCCESS), - ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), - ts_AVP_OriginHost(orig_host), - ts_AVP_OriginRealm(orig_realm), - ts_AVP_UserNameImsi(valueof(imsi)), - sip_auth_data_item, - ts_AVP_3GPP_SIPNumAuthDataItems(1) - }); - -/* Server-Assignment-Request, - * 3GPP TS 29.273 8.1.2.2.2 UE/PDN Registration/DeRegistration Notification - * 3GPP TS 29.273 8.2.2.3 Non-3GPP IP Access Registration Procedure */ -template (present) PDU_DIAMETER -tr_DIA_SWx_SAR(template (present) hexstring imsi := ?, - template (present) octetstring sess_id := ?, - template (present) charstring orig_host := ?, - template (present) charstring orig_realm := ?, - template (present) charstring dest_realm := ?, - template (present) UINT32 hbh_id := ?, - template (present) UINT32 ete_id := ?, - template (present) CxDx_3GPP_Server_Assignment_Type server_ass_type := ?, - template (present) charstring service_selection := ?) := - tr_DIAMETER(flags := '1???????'B, - cmd_code := Server_Assignment, - 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(?, ?), - tr_AVP_AuthSessionState(NO_STATE_MAINTAINED), - tr_AVP_OriginHost(orig_host), - tr_AVP_OriginRealm(orig_realm), - tr_AVP_DestinationRealm(dest_realm), - tr_AVP_UserNameImsi(imsi), - tr_AVP_3GPP_ServerAssignmentType(server_ass_type), - tr_AVP_ServiceSelection(service_selection) - )); - -/* Server-Assignment-Answer, - * 3GPP TS 29.273 8.1.2.2.2 UE/PDN Registration/DeRegistration Notification - * 3GPP TS 29.273 8.2.2.3 Non-3GPP IP Access Registration Procedure */ -template (value) PDU_DIAMETER -ts_DIA_SWx_SAA(template (value) hexstring imsi, - 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) UINT32 hbh_id := '00000000'O, - template (value) UINT32 ete_id := '00000000'O) := - ts_DIAMETER(flags := '01000000'B, - cmd_code := Server_Assignment, - 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_ResultCode(DIAMETER_SUCCESS), - ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), - ts_AVP_OriginHost(orig_host), - ts_AVP_OriginRealm(orig_realm), - ts_AVP_UserNameImsi(valueof(imsi)) - /* TODO: - * [ Non-3GPP-User-Data ] - * [ 3GPP-AAA-Server-Name ] - * [ OC-Supported-Features ] - * [ OC-OLR ] ] - * *[ Load ] - * *[ Supported-Features ] - */ - }); - -/******************************* - * S6b 3GPP TS 29.273 section 9 - *******************************/ - - /* TS 29.273 9.2.2.5.1 AA-Request (AAR) */ -template (value) PDU_DIAMETER -ts_DIA_S6b_AAR(template (value) hexstring imsi, - template (value) octetstring sess_id := c_def_sess_id, - template (value) charstring orig_host := "pgw.localdomain", - template (value) charstring orig_realm := "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 := Authorize_Authenticate, - app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4), - hbh_id := hbh_id, - ete_id := ete_id, - avps := { - ts_AVP_SessionId(sess_id), - /* Optional: DRMP, */ - ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)), - ts_AVP_OriginHost(orig_host), - ts_AVP_OriginRealm(orig_realm), - ts_AVP_DestinationRealm(dest_realm), - ts_AVP_AuthRequestType(AUTHORIZE_ONLY), - ts_AVP_UserNameImsi(valueof(imsi)) - /* TODO: Lots other optional */ - }); - -/* TS 29.273 9.2.2.2.2 AA-Answer (AAA) */ -template (present) PDU_DIAMETER -tr_DIA_S6b_AAA(template (present) octetstring sess_id := ?, - template (present) charstring orig_host := ?, - template (present) charstring orig_realm := ?, - template (present) charstring dest_realm := ?, - template (present) UINT32 hbh_id := ?, - template (present) UINT32 ete_id := ?, - template (present) CxDx_3GPP_Server_Assignment_Type server_ass_type := ?, - template (present) charstring service_selection := ?) := - tr_DIAMETER(flags := '0???????'B, - cmd_code := Authorize_Authenticate, - app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4), - hbh_id := hbh_id, ete_id := ete_id, - avps := superset( - tr_AVP_SessionId(sess_id), - /* Optional: DRMP, */ - tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)), - tr_AVP_AuthRequestType(AUTHORIZE_ONLY), - tr_AVP_ResultCode(DIAMETER_SUCCESS), - tr_AVP_OriginHost(orig_host), - tr_AVP_OriginRealm(orig_realm) - )); - } diff --git a/library/DIAMETER_ts29_273_Templates.ttcn b/library/DIAMETER_ts29_273_Templates.ttcn new file mode 100644 index 0000000..5df1cf1 --- /dev/null +++ b/library/DIAMETER_ts29_273_Templates.ttcn @@ -0,0 +1,248 @@ +module DIAMETER_ts29_273_Templates { + +/* (C) 2023 by sysmocom s.f.m.c. GmbH <info@sysmocom.de + * All rights reserved. + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * Templates for AVPs and messages for TS 29.273 + */ + +import from General_Types all; +import from DIAMETER_Types all; +import from DIAMETER_Templates all; +import from Osmocom_Types all; +import from Misc_Helpers all; + +/* 3GPP TS 29.273 Section 8.2 */ +const uint32_t c_DIAMETER_3GPP_SWx_AID := 16777265; +/* 3GPP TS 29.273 Section 9 */ +const uint32_t c_DIAMETER_3GPP_S6b_AID := 16777272; + +/******************************* + * SWx 3GPP TS 29.273 section 8 + *******************************/ + +/* SIP-Auth-Data-Item , 3GPP TS 29.273 8.2.3.9 */ +template (present) GenericAVP tr_AVP_3GPP_SIPAuthDataItem(template (present) uint32_t num := ?) := { + avp := { + avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Auth_Data_Item), + avp_data := { + avp_CxDx_3GPP_SIP_Auth_Data_Item := superset( + //tr_AVP_3GPP_SIPItemNumber(num), /* Optional */ + tr_AVP_3GPP_SIPAuthScheme(?)//, /* Optional */ + //tr_AVP_3GPP_SIPAuthenticate(?), /* Optional */ + //tr_AVP_3GPP_SIPAuthorization(?), /* Optional */ + //tr_AVP_3GPP_SIPAuthContext(?), /* Optional */ + //tr_AVP_3GPP_ConfidentialityKey(?), /* Optional */ + //tr_AVP_3GPP_IntegrityKey(?) /* Optional */ + /* TODO: + [ SIP-Digest-Authenticate ] + [ Framed-IP-Address ] + [ Framed-IPv6-Prefix ] + [ Framed-Interface-Id ] + [ Line-Identifier ] + *[AVP] + */ + ) + } + } +} +template (value) GenericAVP ts_AVP_3GPP_SIPAuthDataItem(uint32_t num, OCT16 rand, OCT16 ik, OCT16 ck, OCT16 autn, OCT14 auts) := { + avp := { + avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Auth_Data_Item), + avp_data := { + avp_CxDx_3GPP_SIP_Auth_Data_Item := { + ts_AVP_3GPP_SIPItemNumber(num), + ts_AVP_3GPP_SIPAuthScheme(char2oct("Digest-AKAv1-MD5")), + ts_AVP_3GPP_SIPAuthenticate(rand & autn), + ts_AVP_3GPP_SIPAuthorization(rand & auts), + ts_AVP_3GPP_SIPAuthContext(char2oct("foobar")), + ts_AVP_3GPP_ConfidentialityKey(ck), + ts_AVP_3GPP_IntegrityKey(ik) + /* TODO: + [ SIP-Digest-Authenticate ] + [ Framed-IP-Address ] + [ Framed-IPv6-Prefix ] + [ Framed-Interface-Id ] + [ Line-Identifier ] + *[AVP] + */ + } + } + } +} + +/* Multimedia-Auth-Request, 3GPP TS 29.273 8.2.2.1 Authentication Procedure */ +template (present) PDU_DIAMETER +tr_DIA_SWx_MAR(template (present) hexstring imsi := ?, + template (present) octetstring sess_id := ?, + template (present) charstring orig_host := ?, + template (present) charstring orig_realm := ?, + template (present) charstring dest_realm := ?, + template (present) UINT32 hbh_id := ?, + template (present) UINT32 ete_id := ?) := + tr_DIAMETER(flags := '1???????'B, + cmd_code := Multimedia_Auth, + 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(?, ?), + tr_AVP_AuthSessionState(NO_STATE_MAINTAINED), + tr_AVP_OriginHost(orig_host), + tr_AVP_OriginRealm(orig_realm), + tr_AVP_DestinationRealm(dest_realm), + tr_AVP_UserNameImsi(imsi), + tr_AVP_3GPP_SIPAuthDataItem(?), + tr_AVP_3GPP_SIPNumAuthDataItems(?) + )); + +/* Multimedia-Auth-Answer, 3GPP TS 29.273 8.2.2.1 Authentication Procedure */ +template (value) PDU_DIAMETER +ts_DIA_SWx_MAA(template (value) hexstring imsi, + template (value) GenericAVP sip_auth_data_item, + 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) UINT32 hbh_id := '00000000'O, + template (value) UINT32 ete_id := '00000000'O) := + ts_DIAMETER(flags := '01000000'B, + cmd_code := Multimedia_Auth, + 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_ResultCode(DIAMETER_SUCCESS), + ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), + ts_AVP_OriginHost(orig_host), + ts_AVP_OriginRealm(orig_realm), + ts_AVP_UserNameImsi(valueof(imsi)), + sip_auth_data_item, + ts_AVP_3GPP_SIPNumAuthDataItems(1) + }); + +/* Server-Assignment-Request, + * 3GPP TS 29.273 8.1.2.2.2 UE/PDN Registration/DeRegistration Notification + * 3GPP TS 29.273 8.2.2.3 Non-3GPP IP Access Registration Procedure */ +template (present) PDU_DIAMETER +tr_DIA_SWx_SAR(template (present) hexstring imsi := ?, + template (present) octetstring sess_id := ?, + template (present) charstring orig_host := ?, + template (present) charstring orig_realm := ?, + template (present) charstring dest_realm := ?, + template (present) UINT32 hbh_id := ?, + template (present) UINT32 ete_id := ?, + template (present) CxDx_3GPP_Server_Assignment_Type server_ass_type := ?, + template (present) charstring service_selection := ?) := + tr_DIAMETER(flags := '1???????'B, + cmd_code := Server_Assignment, + 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(?, ?), + tr_AVP_AuthSessionState(NO_STATE_MAINTAINED), + tr_AVP_OriginHost(orig_host), + tr_AVP_OriginRealm(orig_realm), + tr_AVP_DestinationRealm(dest_realm), + tr_AVP_UserNameImsi(imsi), + tr_AVP_3GPP_ServerAssignmentType(server_ass_type), + tr_AVP_ServiceSelection(service_selection) + )); + +/* Server-Assignment-Answer, + * 3GPP TS 29.273 8.1.2.2.2 UE/PDN Registration/DeRegistration Notification + * 3GPP TS 29.273 8.2.2.3 Non-3GPP IP Access Registration Procedure */ +template (value) PDU_DIAMETER +ts_DIA_SWx_SAA(template (value) hexstring imsi, + 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) UINT32 hbh_id := '00000000'O, + template (value) UINT32 ete_id := '00000000'O) := + ts_DIAMETER(flags := '01000000'B, + cmd_code := Server_Assignment, + 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_ResultCode(DIAMETER_SUCCESS), + ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), + ts_AVP_OriginHost(orig_host), + ts_AVP_OriginRealm(orig_realm), + ts_AVP_UserNameImsi(valueof(imsi)) + /* TODO: + * [ Non-3GPP-User-Data ] + * [ 3GPP-AAA-Server-Name ] + * [ OC-Supported-Features ] + * [ OC-OLR ] ] + * *[ Load ] + * *[ Supported-Features ] + */ + }); + +/******************************* + * S6b 3GPP TS 29.273 section 9 + *******************************/ + + /* TS 29.273 9.2.2.5.1 AA-Request (AAR) */ +template (value) PDU_DIAMETER +ts_DIA_S6b_AAR(template (value) hexstring imsi, + template (value) octetstring sess_id := c_def_sess_id, + template (value) charstring orig_host := "pgw.localdomain", + template (value) charstring orig_realm := "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 := Authorize_Authenticate, + app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4), + hbh_id := hbh_id, + ete_id := ete_id, + avps := { + ts_AVP_SessionId(sess_id), + /* Optional: DRMP, */ + ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)), + ts_AVP_OriginHost(orig_host), + ts_AVP_OriginRealm(orig_realm), + ts_AVP_DestinationRealm(dest_realm), + ts_AVP_AuthRequestType(AUTHORIZE_ONLY), + ts_AVP_UserNameImsi(valueof(imsi)) + /* TODO: Lots other optional */ + }); + +/* TS 29.273 9.2.2.2.2 AA-Answer (AAA) */ +template (present) PDU_DIAMETER +tr_DIA_S6b_AAA(template (present) octetstring sess_id := ?, + template (present) charstring orig_host := ?, + template (present) charstring orig_realm := ?, + template (present) charstring dest_realm := ?, + template (present) UINT32 hbh_id := ?, + template (present) UINT32 ete_id := ?, + template (present) CxDx_3GPP_Server_Assignment_Type server_ass_type := ?, + template (present) charstring service_selection := ?) := + tr_DIAMETER(flags := '0???????'B, + cmd_code := Authorize_Authenticate, + app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4), + hbh_id := hbh_id, ete_id := ete_id, + avps := superset( + tr_AVP_SessionId(sess_id), + /* Optional: DRMP, */ + tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)), + tr_AVP_AuthRequestType(AUTHORIZE_ONLY), + tr_AVP_ResultCode(DIAMETER_SUCCESS), + tr_AVP_OriginHost(orig_host), + tr_AVP_OriginRealm(orig_realm) + )); + +}