aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/test/diameter_3xxx_SUITE.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-06-02 15:01:17 +0200
committerAnders Svensson <[email protected]>2013-06-02 15:01:17 +0200
commit66afc0dfe18d33ac80ea6de949482c712e4beb9a (patch)
treec3751b39fe5092b4484fbf538b04717653dab21e /lib/diameter/test/diameter_3xxx_SUITE.erl
parente87ef4db28bdb32299682a05314996e34cb5fe25 (diff)
parent21e778b998b895034453251d83c3e6aaa72fe395 (diff)
downloadotp-66afc0dfe18d33ac80ea6de949482c712e4beb9a.tar.gz
otp-66afc0dfe18d33ac80ea6de949482c712e4beb9a.tar.bz2
otp-66afc0dfe18d33ac80ea6de949482c712e4beb9a.zip
Merge branch 'anders/diameter/5xxx_failed_avp/OTP-11092' into maint
* anders/diameter/5xxx_failed_avp/OTP-11092: Fix setting of Failed-AVP on {answer_message, 5xxx} from handle_request
Diffstat (limited to 'lib/diameter/test/diameter_3xxx_SUITE.erl')
-rw-r--r--lib/diameter/test/diameter_3xxx_SUITE.erl36
1 files changed, 34 insertions, 2 deletions
diff --git a/lib/diameter/test/diameter_3xxx_SUITE.erl b/lib/diameter/test/diameter_3xxx_SUITE.erl
index 0ec0d5020f..071b1a1177 100644
--- a/lib/diameter/test/diameter_3xxx_SUITE.erl
+++ b/lib/diameter/test/diameter_3xxx_SUITE.erl
@@ -43,6 +43,7 @@
send_invalid_hdr_bits/1,
send_missing_avp/1,
send_ignore_missing_avp/1,
+ send_5xxx_missing_avp/1,
send_double_error/1,
send_3xxx/1,
send_5xxx/1,
@@ -139,6 +140,7 @@ tc() ->
send_invalid_hdr_bits,
send_missing_avp,
send_ignore_missing_avp,
+ send_5xxx_missing_avp,
send_double_error,
send_3xxx,
send_5xxx].
@@ -279,6 +281,32 @@ send_ignore_missing_avp([_,_]) ->
send_ignore_missing_avp(Config) ->
send_ignore_missing_avp(?group(Config)).
+%% send_5xxx_missing_avp/1
+%%
+%% Send a request with a missing AVP that a callback answers
+%% with {answer_message, 5005}.
+
+%% RFC 6733 allows 5xxx in an answer-message.
+send_5xxx_missing_avp([_, rfc6733]) ->
+ #'diameter_base_answer-message'{'Result-Code' = 5005, %% MISSING_AVP
+ 'Failed-AVP' = [_],
+ 'AVP' = []}
+ = call();
+
+%% RFC 3588 doesn't: sending answer fails.
+send_5xxx_missing_avp([_, rfc3588]) ->
+ {error, timeout} = call();
+
+%% Callback answers, ignores the error
+send_5xxx_missing_avp([_,_]) ->
+ #diameter_base_STA{'Result-Code' = 2001, %% SUCCESS
+ 'Failed-AVP' = [],
+ 'AVP' = []}
+ = call();
+
+send_5xxx_missing_avp(Config) ->
+ send_5xxx_missing_avp(?group(Config)).
+
%% send_double_error/1
%%
%% Send a request with both an invalid E-bit and a missing AVP.
@@ -403,7 +431,8 @@ prepare(Pkt0, Caps, send_double_error) ->
prepare(Pkt, Caps, T)
when T == send_missing_avp;
- T == send_ignore_missing_avp ->
+ T == send_ignore_missing_avp;
+ T == send_5xxx_missing_avp ->
Req = sta(Pkt, Caps),
dehost(diameter_codec:encode(?DICT, Pkt#diameter_packet{msg = Req})).
@@ -487,7 +516,10 @@ request(T, Req, Caps)
request(send_ignore_missing_avp, Req, Caps) ->
{reply, #diameter_packet{msg = answer(Req, Caps),
- errors = false}}. %% ignore errors
+ errors = false}}; %% ignore errors
+
+request(send_5xxx_missing_avp, _Req, _Caps) ->
+ {answer_message, 5005}. %% MISSING_AVP
answer(Req, Caps) ->
#diameter_base_STR{'Session-Id' = SId}