ggsn/pgw: Fix Gy CCR Reporting-Reason expectancies
The Reporting-Reason can be in different places depending on its values.
In the case of TERMINATION, we expect it to be FINAL so we know its
location.
Change-Id: Id33b9bb2f7b469e03a0761dc8807770cfdf77fcc
diff --git a/library/DIAMETER_Templates.ttcn b/library/DIAMETER_Templates.ttcn
index 4b17ac5..03fec7c 100644
--- a/library/DIAMETER_Templates.ttcn
+++ b/library/DIAMETER_Templates.ttcn
@@ -1675,20 +1675,27 @@
{
var AVP multi_services_cc, used_service_unit;
var AVP_Grouped multi_services_cc_data, used_service_unit_data;
+ var template (omit) AVP repreason_tpl;
var AVP repreason, cc_time, cc_in_oct, cc_out_oct;
multi_services_cc := f_DIAMETER_get_avp_or_fail(rx_dia, c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control);
multi_services_cc_data := valueof(multi_services_cc.avp_data.avp_DCC_NONE_Multiple_Services_Credit_Control);
- repreason := f_AVP_Grouped_get_avp_or_fail(multi_services_cc_data, c_AVP_Code_DCA_3GPP_Reporting_Reason);
+ used_service_unit := f_AVP_Grouped_get_avp_or_fail(multi_services_cc_data, c_AVP_Code_DCC_NONE_Used_Service_Unit);
+ used_service_unit_data := valueof(used_service_unit.avp_data.avp_DCC_NONE_Used_Service_Unit);
+
+ /* Reporting-Reason can be either inside Multiple-Services-Credit-Control or inside Used-Service-Unit */
+ repreason_tpl := f_AVP_Grouped_get_avp(multi_services_cc_data, c_AVP_Code_DCA_3GPP_Reporting_Reason);
+ if (istemplatekind(repreason_tpl, "omit")) {
+ repreason := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCA_3GPP_Reporting_Reason);
+ } else {
+ repreason := valueof(repreason_tpl);
+ }
if (not match(repreason.avp_data.avp_DCA_3GPP_Reporting_Reason, repreason_exp)) {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
log2str("3GPP-Reporting-Reason mismatch ", repreason, " vs exp ", repreason_exp));
}
- used_service_unit := f_AVP_Grouped_get_avp_or_fail(multi_services_cc_data, c_AVP_Code_DCC_NONE_Used_Service_Unit);
- used_service_unit_data := valueof(used_service_unit.avp_data.avp_DCC_NONE_Used_Service_Unit);
-
cc_time := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Time);
if (not match(oct2int(cc_time.avp_data.avp_DCC_NONE_CC_Time), cc_time_exp)) {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,