aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-09-05 15:01:10 +0200
committerAnders Svensson <[email protected]>2017-09-05 15:01:10 +0200
commit24dc0a81787336f54259a1212564785c93749eae (patch)
tree730baab4a1ed87ea134b07f68143475036048e78
parent31c4defc94c44f8cdb2bd54b0a4f829f47e4ac69 (diff)
parentc207bcd1cd9633a982d0dfa4a5a8d4569f7c3eac (diff)
downloadotp-24dc0a81787336f54259a1212564785c93749eae.tar.gz
otp-24dc0a81787336f54259a1212564785c93749eae.tar.bz2
otp-24dc0a81787336f54259a1212564785c93749eae.zip
Merge branch 'anders/diameter/answer-message_decode/OTP-14596' into maint
* anders/diameter/answer-message_decode/OTP-14596: Exercise answer-message/AVP decode in traffic suite Exercise answer-message/Failed-AVP decode in traffic suite
-rw-r--r--lib/diameter/test/diameter_traffic_SUITE.erl71
1 files changed, 67 insertions, 4 deletions
diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl
index 91c9fbb420..ffb4a508cd 100644
--- a/lib/diameter/test/diameter_traffic_SUITE.erl
+++ b/lib/diameter/test/diameter_traffic_SUITE.erl
@@ -671,13 +671,13 @@ send_bad_answer(Config) ->
= call(Config, Req).
%% Send an ACR that the server callback answers explicitly with a
-%% protocol error.
+%% protocol error and some AVPs to check the decoding of.
send_protocol_error(Config) ->
Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD},
{'Accounting-Record-Number', 4}],
['answer-message' | #{'Result-Code' := ?TOO_BUSY,
- 'AVP' := [OLR]}]
+ 'AVP' := [OLR | _]} = Avps]
= call(Config, Req),
#diameter_avp{name = 'OC-OLR',
@@ -690,7 +690,61 @@ send_protocol_error(Config) ->
#diameter_avp{name = 'OC-Supported-Features',
value = #{} = Fs}
= OSF,
- 0 = maps:size(Fs).
+ 0 = maps:size(Fs),
+
+ #group{client_dict = D} = group(Config),
+
+ if D == nas4005 ->
+ error = maps:find('Failed-AVP', Avps),
+ #{'AVP' := [_,Failed]}
+ = Avps,
+ #diameter_avp{name = 'Failed-AVP',
+ value = #{'AVP' := [NP,FR,AP]}}
+ = Failed,
+ #diameter_avp{name = 'NAS-Port',
+ value = 44}
+ = NP,
+ #diameter_avp{name = 'Firmware-Revision',
+ value = 12}
+ = FR,
+ #diameter_avp{name = 'Auth-Grace-Period',
+ value = 13}
+ = AP;
+
+ D == diameter_gen_base_rfc3588;
+ D == diameter_gen_basr_accounting ->
+ error = maps:find('Failed-AVP', Avps),
+ #{'AVP' := [_,Failed]}
+ = Avps,
+
+ #diameter_avp{name = 'Failed-AVP',
+ value = #{'AVP' := [NP,FR,AP]}}
+ = Failed,
+ #diameter_avp{name = undefined,
+ value = undefined}
+ = NP,
+ #diameter_avp{name = 'Firmware-Revision',
+ value = 12}
+ = FR,
+ #diameter_avp{name = 'Auth-Grace-Period',
+ value = 13}
+ = AP;
+
+ D == diameter_gen_base_rfc6733;
+ D == diameter_gen_acct_rfc6733 ->
+ #{'Failed-AVP' := [#{'AVP' := [NP,FR,AP]}],
+ 'AVP' := [_]}
+ = Avps,
+ #diameter_avp{name = undefined,
+ value = undefined}
+ = NP,
+ #diameter_avp{name = 'Firmware-Revision',
+ value = 12}
+ = FR,
+ #diameter_avp{name = 'Auth-Grace-Period',
+ value = 13}
+ = AP
+ end.
%% Send a 3xxx Experimental-Result in an answer not setting the E-bit
%% and missing a Result-Code.
@@ -1752,10 +1806,19 @@ request(['ACR' | #{'Accounting-Record-Number' := 4}],
'OC-Reduction-Percentage' => [25],
'OC-Validity-Duration' => [60],
'AVP' => [{'OC-Supported-Features', []}]},
+ %% Include a NAS Failed-AVP AVP that will only be decoded under
+ %% that application. Encode as 'AVP' since RFC 3588 doesn't list
+ %% Failed-AVP in the answer-message grammar while RFC 6733 does.
+ NP = #diameter_avp{data = {nas4005, 'NAS-Port', 44}},
+ FR = #diameter_avp{name = 'Firmware-Revision', value = 12}, %% M=0
+ AP = #diameter_avp{name = 'Auth-Grace-Period', value = 13}, %% M=1
+ Failed = #diameter_avp{data = {diameter_gen_base_rfc3588,
+ 'Failed-AVP',
+ [{'AVP', [NP,FR,AP]}]}},
Ans = ['answer-message', {'Result-Code', ?TOO_BUSY},
{'Origin-Host', OH},
{'Origin-Realm', OR},
- {'AVP', [{'OC-OLR', OLR}]}],
+ {'AVP', [{'OC-OLR', OLR}, Failed]}],
{reply, Ans};
%% send_proxy_info