pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34860?usp=email )


Change subject: DIAMETER_Templates: Add S6b AAR and AAA message templates
......................................................................

DIAMETER_Templates: Add S6b AAR and AAA message templates

Related: OS#6229
Change-Id: I302d9a94e6ffbb62b6db81e1b14484355e55ebe5
---
M library/DIAMETER_Templates.ttcn
1 file changed, 97 insertions(+), 3 deletions(-)



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

diff --git a/library/DIAMETER_Templates.ttcn b/library/DIAMETER_Templates.ttcn
index f909b5f..f46bf37 100644
--- a/library/DIAMETER_Templates.ttcn
+++ b/library/DIAMETER_Templates.ttcn
@@ -127,6 +127,8 @@
 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");

@@ -1518,6 +1520,34 @@
        }
 }

+/* RFC6733 8.7.  Auth-Request-Type AVP */
+template (value) GenericAVP ts_AVP_AuthRequestType(BASE_NONE_Auth_Request_Type 
auth_req_type) := {
+       avp := {
+               avp_header := 
ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Request_Type, '00000000'B),
+               avp_data := {
+                       avp_BASE_NONE_Auth_Request_Type := auth_req_type
+               }
+       }
+}/*
+private function f_tr_AVP_AuthRequestType(template (present) 
BASE_NONE_Auth_Request_Type auth_req_type)
+return template (present) BASE_NONE_Auth_Request_Type {
+       if (istemplatekind(auth_req_type, "?")) {
+               return ?;
+       } else {
+               var template (present) BASE_NONE_Auth_Request_Type c;
+               c := int2oct(enum2int(valueof(auth_req_type)), 4);
+               return c;
+       }
+}*/
+template (present) GenericAVP tr_AVP_AuthRequestType(template (present) 
BASE_NONE_Auth_Request_Type auth_req_type) := {
+       avp := {
+               avp_header := 
tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Request_Type),
+               avp_data := {
+                       avp_BASE_NONE_Auth_Request_Type := auth_req_type
+               }
+       }
+}
+

 /* 5.3.1 Capabilities Exchange Request */
 template (value) PDU_DIAMETER
@@ -2276,9 +2306,9 @@
        }
 }

-/*****************************
- * SWx 3GPP TS 29.273
- *****************************/
+/*******************************
+ * 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 := ?) := {
@@ -2445,4 +2475,58 @@
                         */
        });

+/*******************************
+ * 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)
+       ));
+
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34860?usp=email
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: I302d9a94e6ffbb62b6db81e1b14484355e55ebe5
Gerrit-Change-Number: 34860
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to