aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/test
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-09-03 13:32:04 +0200
committerAnders Svensson <[email protected]>2017-09-03 13:32:04 +0200
commit87f5f42374b2b4f43fee91ff77f2c739bcf9abf6 (patch)
tree6e258a456ceb69db071df764a974cd0d5116b558 /lib/diameter/test
parent7c5cf17a3e2e5f870138f4a3efee6fb1ff63a87d (diff)
parent3cba7ec073e449db99173ad07a5652a2026f0aa5 (diff)
downloadotp-87f5f42374b2b4f43fee91ff77f2c739bcf9abf6.tar.gz
otp-87f5f42374b2b4f43fee91ff77f2c739bcf9abf6.tar.bz2
otp-87f5f42374b2b4f43fee91ff77f2c739bcf9abf6.zip
Merge branch 'anders/diameter/Proxy-Info/OTP-9869' into maint
* anders/diameter/Proxy-Info/OTP-9869: Fix handling of Proxy-Info in answers formulated by diameter
Diffstat (limited to 'lib/diameter/test')
-rw-r--r--lib/diameter/test/diameter_traffic_SUITE.erl23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl
index f2c7ac0ff9..31900fc97f 100644
--- a/lib/diameter/test/diameter_traffic_SUITE.erl
+++ b/lib/diameter/test/diameter_traffic_SUITE.erl
@@ -49,6 +49,7 @@
send_protocol_error/1,
send_experimental_result/1,
send_arbitrary/1,
+ send_proxy_info/1,
send_unknown/1,
send_unknown_short/1,
send_unknown_mandatory/1,
@@ -137,6 +138,7 @@
-define(A, list_to_atom).
-define(L, atom_to_list).
+-define(B, iolist_to_binary).
%% Don't use is_record/2 since dictionary hrl's aren't included.
%% (Since they define conflicting records with the same names.)
@@ -444,6 +446,7 @@ tc() ->
send_protocol_error,
send_experimental_result,
send_arbitrary,
+ send_proxy_info,
send_unknown,
send_unknown_short,
send_unknown_mandatory,
@@ -694,6 +697,19 @@ send_arbitrary(Config) ->
= call(Config, Req),
"XXX" = string(V, Config).
+%% Send Proxy-Info in an ASR that the peer answers with 3xxx, and
+%% ensure that the AVP is returned.
+send_proxy_info(Config) ->
+ H0 = ?B(?util:unique_string()),
+ S0 = ?B(?util:unique_string()),
+ Req = ['ASR', {'Proxy-Info', #{'Proxy-Host' => H0,
+ 'Proxy-State' => S0}}],
+ ['answer-message' | #{'Result-Code' := 3999,
+ 'Proxy-Info' := [Rec]}]
+ = call(Config, Req),
+ {H, S, []} = proxy_info(Rec, Config),
+ [H0, S0] = [?B(X) || X <- [H,S]].
+
%% Send an unknown AVP (to some client) and check that it comes back.
send_unknown(Config) ->
Req = ['ASR', {'AVP', [#diameter_avp{code = 999,
@@ -786,7 +802,7 @@ send_grouped_error(Config) ->
[[#diameter_avp{name = 'Proxy-Info', value = V}]]
= failed_avps(Avps, Config),
{Empty, undefined, []} = proxy_info(V, Config),
- <<0>> = iolist_to_binary(Empty).
+ <<0>> = ?B(Empty).
%% Send an STR that the server ignores.
send_noreply(Config) ->
@@ -1743,6 +1759,11 @@ request(['ACR' | #{'Accounting-Record-Number' := 4}],
{'Origin-Realm', OR}],
{reply, Ans};
+%% send_proxy_info
+request(['ASR' | #{'Proxy-Info' := _}],
+ _) ->
+ {protocol_error, 3999};
+
request(['ASR' | #{'Session-Id' := SId} = Avps],
#diameter_caps{origin_host = {OH, _},
origin_realm = {OR, _}}) ->