Skip to content

Commit

Permalink
Review rework
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier M. Torres committed May 27, 2024
1 parent aeb5b34 commit 957ef4c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion test/diameter_nasreq_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ simple(Config, TermOpts) ->

simple_tdf_userid(Config, TermOpts) ->
Stats0 = get_stats(?SERVICE),
Msisdn = ?MSISDN_FOR_IMEI_SV, % <<"543148000012345">>,
Msisdn = ?MSISDN_FOR_IMEI_SV,
Imsi = <<"250071234567890">>,
Imei = <<82,21,50,96,32,80,30,0>>,
{ok, Session} = ergw_aaa_session_sup:new_session(
Expand Down
43 changes: 20 additions & 23 deletions test/diameter_test_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -281,32 +281,29 @@ handle_request(#diameter_packet{msg = ['AAR' | Msg]}, _SvcName, {_, Caps}, _Extr
[<<0,0,0,0>>] -> [<<10,106,14,227>>];
FramedIPReq -> FramedIPReq
end,
OkResponse = fun() ->
AAA0 = #{'Session-Id' => Id,
'Result-Code' => 2001,
'Origin-Host' => OH,
'Origin-Realm' => OR,
'SN-Primary-DNS-Server' => [{1,2,3,4}],
'SN-Secondary-DNS-Server' => [{5,6,7,8}],
'Acct-Interim-Interval' => [InterimAccounting],
'Authorization-Lifetime' => [AuthLifeTime],
'Framed-IP-Address' => FramedIP,
'Framed-MTU' => 1500,
'Auth-Request-Type' => Type,
'Auth-Application-Id' => AppId},
AAA = if is_map_key('Framed-IPv6-Prefix', Msg) ->
AAA0#{'3GPP-IPv6-DNS-Servers' =>
ergw_aaa_3gpp_dict:encode('3GPP-IPv6-DNS-Servers',
[{16#fe80,0,0,0,0,0,0,1},
{16#fe80,0,0,0,0,0,0,2}])};
true -> AAA0
end,
{reply, ['AAA' | AAA]}
AAA0 = #{'Session-Id' => Id,
'Result-Code' => 2001,
'Origin-Host' => OH,
'Origin-Realm' => OR,
'SN-Primary-DNS-Server' => [{1,2,3,4}],
'SN-Secondary-DNS-Server' => [{5,6,7,8}],
'Acct-Interim-Interval' => [InterimAccounting],
'Authorization-Lifetime' => [AuthLifeTime],
'Framed-IP-Address' => FramedIP,
'Framed-MTU' => 1500,
'Auth-Request-Type' => Type,
'Auth-Application-Id' => AppId},
AAA = if is_map_key('Framed-IPv6-Prefix', Msg) ->
AAA0#{'3GPP-IPv6-DNS-Servers' =>
ergw_aaa_3gpp_dict:encode('3GPP-IPv6-DNS-Servers',
[{16#fe80,0,0,0,0,0,0,1},
{16#fe80,0,0,0,0,0,0,2}])};
true -> AAA0
end,
case Msg of
#{'Calling-Station-Id' := ?MSISDN_FOR_IMEI_SV, '3GPP-IMEISV' := _} -> OkResponse();
#{'Calling-Station-Id' := ?MSISDN_FOR_IMEI_SV, '3GPP-IMEISV' := _} -> {reply, ['AAA' | AAA]};
#{'Calling-Station-Id' := ?MSISDN_FOR_IMEI_SV} -> {answer_message, 5005};
_ -> OkResponse()
_ -> {reply, ['AAA' | AAA]}
end;

handle_request(#diameter_packet{msg = ['STR' | Msg]}, _SvcName, {_, Caps}, _Extra)
Expand Down
2 changes: 1 addition & 1 deletion test/ergw_aaa_test_lib.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
reset_session_stats/0]).
-endif.

-define(MSISDN_FOR_IMEI_SV, "AAAAAAAAAAAAAAA").
-define(MSISDN_FOR_IMEI_SV, "AAAAAAAAAAAAAAA").

0 comments on commit 957ef4c

Please sign in to comment.