pgw: Validate charging reported values

Change-Id: I5024abc672bf92d41027c4c78d2925d0537bb470
diff --git a/pgw/PGW_Tests.ttcn b/pgw/PGW_Tests.ttcn
index 6df4ca7..d8ee60d 100644
--- a/pgw/PGW_Tests.ttcn
+++ b/pgw/PGW_Tests.ttcn
@@ -111,6 +111,9 @@
 	var OCT4	g_ip4_addr;
 	var OCT16	g_ip6_addr;
 	var integer	g_ip6_plen;
+
+	/* Store last received Gy message */
+	var PDU_DIAMETER g_rx_gy;
 }
 
 /* configuration data for a given Session */
@@ -487,31 +490,31 @@
 	return tpl;
 }
 
-private altstep as_DIA_Gy_CCR(DCC_NONE_CC_Request_Type req_type) runs on PGW_Session_CT {
-	var PDU_DIAMETER rx_dia;
-	[] Gy.receive(f_tr_DIA_Gy_CCR(req_type := req_type)) -> value rx_dia {
+private altstep as_DIA_Gy_CCR(DCC_NONE_CC_Request_Type req_type)
+runs on PGW_Session_CT {
+	[] Gy.receive(f_tr_DIA_Gy_CCR(req_type := req_type)) -> value g_rx_gy {
 		var template (value) PDU_DIAMETER tx_dia;
 		var template (omit) AVP avp;
 		var octetstring sess_id;
 		var AVP_Unsigned32 req_num;
 
-		avp := f_DIAMETER_get_avp(rx_dia, c_AVP_Code_BASE_NONE_Session_Id);
+		avp := f_DIAMETER_get_avp(g_rx_gy, c_AVP_Code_BASE_NONE_Session_Id);
 		sess_id := valueof(avp.avp_data.avp_BASE_NONE_Session_Id);
 
-		avp := f_DIAMETER_get_avp(rx_dia, c_AVP_Code_DCC_NONE_CC_Request_Number);
+		avp := f_DIAMETER_get_avp(g_rx_gy, c_AVP_Code_DCC_NONE_CC_Request_Number);
 		req_num := valueof(avp.avp_data.avp_DCC_NONE_CC_Request_Number);
 		if (g_pars.gy_validity_time > 0) {
-			tx_dia := ts_DIA_Gy_CCA_ValidityTime(rx_dia.hop_by_hop_id, rx_dia.end_to_end_id, sess_id,
+			tx_dia := ts_DIA_Gy_CCA_ValidityTime(g_rx_gy.hop_by_hop_id, g_rx_gy.end_to_end_id, sess_id,
 						 req_type, req_num, g_pars.gy_validity_time);
 		} else {
-			tx_dia := ts_DIA_Gy_CCA(rx_dia.hop_by_hop_id, rx_dia.end_to_end_id, sess_id,
+			tx_dia := ts_DIA_Gy_CCA(g_rx_gy.hop_by_hop_id, g_rx_gy.end_to_end_id, sess_id,
 						 req_type, req_num);
 		}
 		Gy.send(tx_dia);
 	}
-	[] Gy.receive(PDU_DIAMETER:?) -> value rx_dia {
+	[] Gy.receive(PDU_DIAMETER:?) -> value g_rx_gy {
 		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
-					log2str("Received unexpected DIAMETER Gy", rx_dia));
+					log2str("Received unexpected DIAMETER Gy", g_rx_gy));
 	}
 }
 
@@ -858,14 +861,20 @@
 
 	/* We should receive an update even if no traffic is sent: */
 	as_DIA_Gy_CCR(UPDATE_REQUEST);
+	f_validate_gy_cc_report(g_rx_gy, VALIDITY_TIME, (3..4), 0, 0);
 
 	d := activate(as_DIA_Gy_CCR(UPDATE_REQUEST));
 	f_ping4(mp_ping_hostname);
 	/* Let the CCA reach the GGSN */
 	f_sleep(0.5);
 	deactivate(d);
+	f_validate_gy_cc_report(g_rx_gy, VALIDITY_TIME, (3..4), (28..1000), (28..1000));
+
+	as_DIA_Gy_CCR(UPDATE_REQUEST);
+	f_validate_gy_cc_report(g_rx_gy, VALIDITY_TIME, (3..4), ?, ?);
 
 	f_delete_session(omit, g_teic, '10'O);
+	f_validate_gy_cc_report(g_rx_gy, FINAL, (0..1), 0, 0);
 	setverdict(pass);
 }
 testcase TC_gy_charging_cc_time() runs on PGW_Test_CT {