library/DIAMETER_Templates: prettify & enrich AIR/AIA templates

* Make both {hbh,ete}_id parameters last among the others;
* Use more elegant and consistent template formatting;
* Make DestinationRealm value configurable;
* Make SessionId value configurable.

Change-Id: Iaf6472fecbadd58e86b78c59348d9924ab57f97d
Related: SYS#5602
This commit is contained in:
Vadim Yanitskiy 2021-12-11 15:46:30 +03:00
parent 5e1bdc04d1
commit 2dba494201
2 changed files with 51 additions and 33 deletions

View File

@ -877,43 +877,60 @@ ts_DIA_CEA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
template (value) PDU_DIAMETER
ts_DIA_AIR(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
template (value) octetstring sess_id,
template (value) charstring dest_realm, hexstring imsi)
:= ts_DIAMETER(flags:='00000000'B, cmd_code:=Authentication_Information, hbh_id:=hbh_id, ete_id:=ete_id,
avps := {
ts_AVP_SessionId(sess_id),
ts_AVP_DestinationRealm(dest_realm),
ts_AVP_UserNameImsi(imsi),
/* Requested EUTRAN Auth Info */
ts_AVP_RequestedEutranAuthInfo,
ts_AVP_3GPP_VisitedPlmnId('11111F'O)
ts_DIA_AIR(/* template (value) */ hexstring imsi,
template (value) octetstring sess_id := c_def_sess_id,
template (value) charstring dest_realm := "localdomain",
template (value) UINT32 hbh_id := '00000000'O,
template (value) UINT32 ete_id := '00000000'O) :=
ts_DIAMETER(flags := '00000000'B,
cmd_code := Authentication_Information,
hbh_id := hbh_id,
ete_id := ete_id,
avps := {
ts_AVP_SessionId(sess_id),
ts_AVP_DestinationRealm(dest_realm),
ts_AVP_UserNameImsi(imsi),
/* Requested EUTRAN Auth Info */
ts_AVP_RequestedEutranAuthInfo,
ts_AVP_3GPP_VisitedPlmnId('11111F'O)
});
template (present) PDU_DIAMETER
tr_DIA_AIR(hexstring imsi) := tr_DIAMETER(flags := '11000000'B, cmd_code:=Authentication_Information,
app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
avps := superset(
tr_AVP_SessionId,
tr_AVP_DestinationRealm,
tr_AVP_UserNameImsi(imsi),
tr_AVP_3GPP_VisitedPlmnId
tr_DIA_AIR(/* template (present) */ hexstring imsi,
template (present) octetstring sess_id := ?,
template (present) charstring dest_realm := ?,
template (present) UINT32 hbh_id := ?,
template (present) UINT32 ete_id := ?) :=
tr_DIAMETER(flags := '11000000'B,
cmd_code := Authentication_Information,
app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
hbh_id := hbh_id, ete_id := ete_id,
avps := superset(
tr_AVP_SessionId(sess_id),
tr_AVP_DestinationRealm(dest_realm),
tr_AVP_UserNameImsi(imsi),
tr_AVP_3GPP_VisitedPlmnId
));
/* TS 29.262 5.2.3.1 + 7.2.6 Authentication Information Answer */
template (value) PDU_DIAMETER
ts_DIA_AIA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
template (value) octetstring sess_id,
template (value) AVP_list auth_info_contents)
:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Authentication_Information,
app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id,
avps := {
ts_AVP_SessionId(sess_id),
ts_AVP_ResultCode(DIAMETER_SUCCESS),
ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
ts_AVP_OriginHost("hss.localdomain"),
ts_AVP_OriginRealm("localdomain"),
ts_AVP_3GPP_AuthInfo(auth_info_contents)
ts_DIA_AIA(template (value) AVP_list auth_info_contents,
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 := Authentication_Information,
app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
hbh_id := hbh_id,
ete_id := ete_id,
avps := {
ts_AVP_SessionId(sess_id),
ts_AVP_ResultCode(DIAMETER_SUCCESS),
ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
ts_AVP_OriginHost(orig_host),
ts_AVP_OriginRealm(orig_realm),
ts_AVP_3GPP_AuthInfo(auth_info_contents)
});

View File

@ -483,8 +483,9 @@ private altstep as_DIA_AuthInfo() runs on ConnHdlr {
/* compute tuple */
auth_info_content := { ts_AVP_EutranVec(1, '20080c3818183b522614162c07601d0d'O, '6a91970e838fd079'O, 'f11b89a2a8be00001f9c526f3d75d44c'O, '95AFAD9A0D29AFAA079A9451DF7161D7EE4CBF2AF9387F766D058BB6B44B905D'O) };
DIAMETER.send(ts_DIA_AIA(rx_dia.hop_by_hop_id, rx_dia.end_to_end_id,
sess_id, auth_info_content));
DIAMETER.send(ts_DIA_AIA(auth_info_content, sess_id,
hbh_id := rx_dia.hop_by_hop_id,
ete_id := rx_dia.end_to_end_id));
}
}