pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43436?usp=email )
Change subject: WIP: TC_gy_ccr_update_rejected ......................................................................
WIP: TC_gy_ccr_update_rejected
Change-Id: I9ad9fb1520f8a2163ed90e8ca5c121edcb267006 --- M library/PFCP_Templates.ttcn M smf/SMF_Session_CT.ttcn M smf/SMF_Tests.ttcn 3 files changed, 489 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/36/43436/1
diff --git a/library/PFCP_Templates.ttcn b/library/PFCP_Templates.ttcn index b59ce7b..9d6bcfc 100644 --- a/library/PFCP_Templates.ttcn +++ b/library/PFCP_Templates.ttcn @@ -84,9 +84,123 @@ template (present) Node_ID tr_PFCP_Node_ID_fqdn(template (present) octetstring fqdn) := tr_PFCP_Node_ID(PFCP_Node_ID_FQDN, fqdn);
+/* 8.2.19 Reporting Triggers */ +template (value) Reporting_Triggers +ts_PFCP_Reporting_Triggers(template (value) BIT1 perio := '0'B, + template (value) BIT1 volth := '0'B, + template (value) BIT1 timth := '0'B, + template (value) BIT1 quhti := '0'B, + template (value) BIT1 start_ := '0'B, + template (value) BIT1 stop_ := '0'B, + template (value) BIT1 droth := '0'B, + template (value) BIT1 liusa := '0'B, + template (value) BIT1 volqu := '0'B, + template (value) BIT1 timqu := '0'B, + template (value) BIT1 envcl := '0'B, + template (value) BIT1 macar := '0'B, + template (value) BIT1 eveth := '0'B, + template (value) BIT1 evequ := '0'B, + template (value) BIT1 ipmjl := '0'B, + template (value) BIT1 quvti := '0'B, + template (value) BIT1 upint := '0'B, + template (value) BIT1 reemr := '0'B, + template (value) BIT6 spare := '000000'B) +:= { + elementIdentifier := 37, + lengthIndicator := 0, + perio := perio, + volth := volth, + timth := timth, + quhti := quhti, + start_ := start_, + stop_ := stop_, + droth := droth, + liusa := liusa, + volqu := volqu, + timqu := timqu, + envcl := envcl, + macar := macar, + eveth := eveth, + evequ := evequ, + ipmjl := ipmjl, + quvti := quvti, + upint := upint, + reemr := reemr, + spare := spare +} +template (present) Reporting_Triggers +tr_PFCP_Reporting_Triggers(template (present) BIT1 perio := ?, + template (present) BIT1 volth := ?, + template (present) BIT1 timth := ?, + template (present) BIT1 quhti := ?, + template (present) BIT1 start_ := ?, + template (present) BIT1 stop_ := ?, + template (present) BIT1 droth := ?, + template (present) BIT1 liusa := ?, + template (present) BIT1 volqu := ?, + template (present) BIT1 timqu := ?, + template (present) BIT1 envcl := ?, + template (present) BIT1 macar := ?, + template (present) BIT1 eveth := ?, + template (present) BIT1 evequ := ?, + template (present) BIT1 ipmjl := ?, + template (present) BIT1 quvti := ?, + template (present) BIT1 upint := ?, + template (present) BIT1 reemr := ?, + template (present) BIT6 spare := ?) +:= { + elementIdentifier := 37, + lengthIndicator := ?, + perio := perio, + volth := volth, + timth := timth, + quhti := quhti, + start_ := start_, + stop_ := stop_, + droth := droth, + liusa := liusa, + volqu := volqu, + timqu := timqu, + envcl := envcl, + macar := macar, + eveth := eveth, + evequ := evequ, + ipmjl := ipmjl, + quvti := quvti, + upint := upint, + reemr := reemr, + spare := spare +} + +/* 8.2.21 Report Type */ +template (value) Report_Type +ts_Report_Type(template (value) BIT1 dldr := '0'B, + template (value) BIT1 usar := '0'B, + template (value) BIT1 erir := '0'B, + template (value) BIT1 upir := '0'B, + template (value) BIT1 tmir := '0'B, + template (value) BIT1 sesr := '0'B, + template (value) BIT1 uisr := '0'B, + template (value) BIT1 spare := '0'B) := { + elementIdentifier := 39, + lengthIndicator := 0, /* overwritten */ + dldr := dldr, + usar := usar, + erir := erir, + upir := upir, + tmir := tmir, + sesr := sesr, + uisr := uisr, + spare := spare +} with { + variant "PRESENCE (elementIdentifier = 39; )" + variant (lengthIndicator) "LENGTHTO(dldr,usar,erir,upir,tmir,sesr,uisr,spare)" +} + /* 8.2.25 UP Function Features */ template (value) UP_Function_Features -ts_PFCP_UP_Function_Features(template (value) BIT1 ftup := '0'B) := { +ts_PFCP_UP_Function_Features(template (value) BIT1 ftup := '0'B, + template (value) BIT1 vtime := '0'B) := { elementIdentifier := 43, lengthIndicator := 0, /* octet 5: */ @@ -119,7 +233,7 @@ /* octet 8: */ mpas := '0'B, rttl := '0'B, - vtime := '0'B, + vtime := vtime, norp := '0'B, iptv := '0'B, ip6pl := '0'B, @@ -190,6 +304,33 @@ spare:= '0'B }
+/* 8.2.40 Measurement Method */ +template (value) Measurement_Method +ts_PFCP_Measurement_Method(template (value) BIT1 durat := '0'B, + template (value) BIT1 volum := '0'B, + template (value) BIT1 event := '0'B, + template (value) BIT5 spare := '00000'B) := { + elementIdentifier := 62, + lengthIndicator := 0, /* overwritten */ + durat := durat, + volum := volum, + event := event, + spare := spare +} + +template (present) Measurement_Method +tr_PFCP_Measurement_Method(template (present) BIT1 durat := ?, + template (present) BIT1 volum := ?, + template (present) BIT1 event := ?, + template (present) BIT5 spare := ?) := { + elementIdentifier := 62, + lengthIndicator := ?, + durat := durat, + volum := volum, + event := event, + spare := spare +} + /* 8.2.41 Usage Report Trigger */ template (value) Usage_Report_Trigger ts_PFCP_Usage_Report_Trigger(template (value) BIT1 perio := '0'B, @@ -244,6 +385,59 @@ spare7_8 := spare7_8 }
+template (present) Usage_Report_Trigger +tr_PFCP_Usage_Report_Trigger(template (present) BIT1 perio := ?, + template (present) BIT1 volth := ?, + template (present) BIT1 timth := ?, + template (present) BIT1 quhti := ?, + template (present) BIT1 start_ := ?, + template (present) BIT1 stop_ := ?, + template (present) BIT1 droth := ?, + template (present) BIT1 immer := ?, + template (present) BIT1 volqu := ?, + template (present) BIT1 timqu := ?, + template (present) BIT1 liusa := ?, + template (present) BIT1 termr := ?, + template (present) BIT1 monit := ?, + template (present) BIT1 envcl := ?, + template (present) BIT1 macar := ?, + template (present) BIT1 eveth := ?, + template (present) BIT1 evequ := ?, + template (present) BIT1 tebur := ?, + template (present) BIT1 ipmjl := ?, + template (present) BIT1 quvti := ?, + template (present) BIT1 emrre := ?, + template (present) BIT1 upint := ?, + template (present) BIT1 spare7_7 := ?, + template (present) BIT1 spare7_8 := ?) := { + elementIdentifier := 63, + lengthIndicator := ?, + perio := perio, + volth := volth, + timth := timth, + quhti := quhti, + start_ := start_, + stop_ := stop_, + droth := droth, + immer := immer, + volqu := volqu, + timqu := timqu, + liusa := liusa, + termr := termr, + monit := monit, + envcl := envcl, + macar := macar, + eveth := eveth, + evequ := evequ, + tebur := tebur, + ipmjl := ipmjl, + quvti := quvti, + emrre := emrre, + upint := upint, + spare7_7 := spare7_7, + spare7_8 := spare7_8 +} + /* 8.2.45 Duration Measurement */ template (value) Duration_Measurement ts_PFCP_Duration_Measurement(template (value) LIN4_BO_LAST duration) := { @@ -284,6 +478,20 @@ return omit; }
+/* 8.2.54 URR ID */ +template (value) URR_ID +ts_PFCP_URR_ID(template (value) LIN4_BO_LAST urr_id) := { + elementIdentifier := 81, + lengthIndicator := 0, + id_value := urr_id +} +template (present) URR_ID +tr_PFCP_URR_ID(template (present) LIN4_BO_LAST urr_id := ?) := { + elementIdentifier := 81, + lengthIndicator := ?, + id_value := urr_id +} + /* 8.2.65 Recovery Time Stamp */ template (value) Recovery_Time_Stamp ts_PFCP_Recovery_Timestamp(template (value) LIN4_BO_LAST time_value) := { @@ -298,6 +506,28 @@ time_value := time_value };
+/* 8.2.68 Measurement Information */ +template (present) Measurement_Information +tr_Measurement_Information(template (present) BIT1 mbqe := ?, + template (present) BIT1 inam := ?, + template (present) BIT1 radi := ?, + template (present) BIT1 istm := ?, + template (present) BIT1 mnop := ?, + template (present) BIT1 sspoc := ?, + template (present) BIT1 aspoc := ?, + template (present) BIT1 ciam := ?) := { + elementIdentifier := 100, + lengthIndicator := ?, + mbqe := mbqe, + inam := inam, + radi := radi, + istm := istm, + mnop := mnop, + sspoc := sspoc, + aspoc := aspoc, + ciam := ciam +} + /* 8.2.71 UR-SEQN */ template (value) UR_SEQN ts_UR_SEQN(template (value) LIN4_BO_LAST ur_seqn) := { @@ -306,6 +536,15 @@ ur_seqn := ur_seqn }
+/* 8.2.132 Quota Validity Time */ +template (present) Quota_Validity_Time +tr_Quota_Validity_Time(template (present) LIN4_BO_LAST validity_time_value := ?) := { + elementIdentifier := 181, + lengthIndicator := ?, + validity_time_value := validity_time_value +} + + template (value) PDU_PFCP ts_PDU_PFCP_ := { s_flag := '0'B, mp := '0'B, @@ -968,6 +1207,70 @@ } }
+/* 7.5.2.4 Create URR IE within PFCP Session Establishment Request */ +template (value) Create_URR +ts_PFCP_Create_URR(template (value) LIN4_BO_LAST urr_id, + template (value) Measurement_Method measurement_method := ts_PFCP_Measurement_Method(), + template (value) Reporting_Triggers reporting_triggers := ts_PFCP_Reporting_Triggers()) := { + elementIdentifier := 6, + lengthIndicator := 0, + grouped_ie := { + urr_id := ts_PFCP_URR_ID(urr_id), + measurement_method := measurement_method, + reporting_triggers := reporting_triggers, + measurement_period := omit, + volume_threshold := omit, + volume_quota := omit, + time_threshold := omit, + time_quota := omit, + quota_holding_time := omit, + dropped_dl_traffic_threshold := omit, + quota_validity_time := omit, + monitoring_time := omit, + subsequent_volume_threshold := omit, + subsequent_time_threshold := omit, + subsequent_volume_quota := omit, + subsequent_time_quota := omit, + inactivity_detection_time := omit, + linked_urr_id := omit, + measurement_information := omit, + time_qouta_mechanism := omit, + aggregated_urrs:= omit + } +} +template (present) Create_URR +tr_PFCP_Create_URR(template (present) LIN4_BO_LAST urr_id := ?, + template (present) Measurement_Method measurement_method := tr_PFCP_Measurement_Method(), + template (present) Reporting_Triggers reporting_triggers := tr_PFCP_Reporting_Triggers(), + template Quota_Validity_Time quota_validity_time := *, + template Measurement_Information measurement_information := *) := { + elementIdentifier := 6, + lengthIndicator := ?, + grouped_ie := { + urr_id := tr_PFCP_URR_ID(urr_id), + measurement_method := measurement_method, + reporting_triggers := reporting_triggers, + measurement_period := *, + volume_threshold := *, + volume_quota := *, + time_threshold := *, + time_quota := *, + quota_holding_time := *, + dropped_dl_traffic_threshold := *, + quota_validity_time := quota_validity_time, + monitoring_time := *, + subsequent_volume_threshold := *, + subsequent_time_threshold := *, + subsequent_volume_quota := *, + subsequent_time_quota := *, + inactivity_detection_time := *, + linked_urr_id := *, + measurement_information := measurement_information, + time_qouta_mechanism := *, + aggregated_urrs:= * + } +} + /* 7.5.2 PFCP Session Establishment Request */ template (value) PDU_PFCP ts_PFCP_Session_Est_Req(template (value) Node_ID node_id, @@ -998,7 +1301,8 @@ tr_PFCP_Session_Est_Req(template (present) Node_ID node_id := ?, template (present) F_SEID cp_f_seid := ?, template (present) Create_PDR_list create_pdr := ?, - template (present) Create_FAR_list create_far := ?) + template (present) Create_FAR_list create_far := ?, + template Create_URR_list create_urr := *) modifies tr_PDU_PFCP_ := { seid := '0000000000000000'O, /* shall be set to 0 as per 7.2.2.4.2 */ message_body := { @@ -1007,7 +1311,7 @@ CP_F_SEID := cp_f_seid, create_PDR_list := create_pdr, create_FAR_list := create_far, - create_URR_list := *, + create_URR_list := create_urr, create_QER_list := *, create_BAR := *, create_traffic_endpoint_list := *, @@ -1276,4 +1580,84 @@ } }
+/* 7.5.8 PFCP Session Report Request */ +template (value) PDU_PFCP +ts_PFCP_Session_Report_Request(template (value) OCT8 seid, + template (value) Report_Type report_type, + template (omit) Downlink_Data_Report downlink_data_report := omit, + template (omit) Usage_Report_Report_Request_list usage_report := omit, + template (omit) Error_Indication_Report error_indication_report := omit, + template (omit) Load_Control_Information load_control_information := omit, + template (omit) Overload_Control_Information overload_control_information := omit, + template (omit) Additional_Usage_Reports_Information additional_usage_reports_information := omit) +modifies ts_PDU_PFCP_ := { + seid := seid, + message_body := { + pfcp_session_report_request := { + report_type := report_type, + downlink_data_report := downlink_data_report, + usage_report := usage_report, + error_indication_report := error_indication_report, + load_control_information := load_control_information, + overload_control_information := overload_control_information, + additional_usage_reports_information := additional_usage_reports_information + } + } +} + +/* 7.5.8.3 Usage Report IE within PFCP Session Report Request */ +template (value) Usage_Report_Report_Request +ts_Usage_Report_Report_Request(template (value) URR_ID urr_id, + template (value) LIN4_BO_LAST ur_seqn, + template (value) Usage_Report_Trigger usage_report_trigger, + template (omit) Start_Time start_time := omit, + template (omit) End_Time end_time := omit, + template (omit) Volume_Measurement volume_measurement := omit, + template (omit) Duration_Measurement duration_measurement := omit, + template (omit) Application_Detection_Information application_detection_information := omit, + template (omit) UE_IP_Address ue_ip_address := omit, + template (omit) PDN_Instance pdn_instance := omit, + template (omit) Time_of_First_Packet time_of_first_packet := omit, + template (omit) Time_of_Last_Packet time_of_last_packet := omit, + template (omit) Usage_Information usage_information := omit, + template (omit) Query_URR_Reference query_urr_reference := omit +) := { + elementIdentifier := 80, + lengthIndicator := 0, /* overwritten */ + grouped_ie := { + urr_id := urr_id, + ur_seqn := ts_UR_SEQN(ur_seqn), + usage_report_trigger := usage_report_trigger, + start_time := start_time, + end_time := end_time, + volume_measurement := volume_measurement, + duration_measurement := duration_measurement, + application_detection_information := application_detection_information, + ue_ip_address := ue_ip_address, + pdn_instance := pdn_instance, + time_of_first_packet := time_of_first_packet, + time_of_last_packet := time_of_last_packet, + usage_information := usage_information, + query_urr_reference := query_urr_reference + } +} + +/* 7.5.9 PFCP Session Report Response */ + + +template (present) PDU_PFCP +tr_PFCP_Session_Report_Resp(template (present) OCT8 seid := ?, + template (present) Cause cause := tr_PFCP_Cause(REQUEST_ACCEPTED)) +modifies tr_PDU_PFCP_ := { + seid := seid, + message_body := { + pfcp_session_report_response := { + cause := cause, + offending_IE := *, + update_BAR := *, + pfcpSMRsp_flags := * + } + } +} + } diff --git a/smf/SMF_Session_CT.ttcn b/smf/SMF_Session_CT.ttcn index 30077c8..89e862f 100644 --- a/smf/SMF_Session_CT.ttcn +++ b/smf/SMF_Session_CT.ttcn @@ -111,14 +111,16 @@ type record Session_URR { URR_ID urr_id, integer ur_seqn, - integer start_time /* In system clock, call */ + integer start_time, /* In system clock */ + integer last_report_time /* In system clock */ } type record of Session_URR Session_URR_List; template (value) Session_URR ts_Session_URR(template (value) URR_ID urr_id, integer start_time) := { urr_id := urr_id, ur_seqn := 0, - start_time := start_time + start_time := start_time, + last_report_time := start_time } type record PfcpParameters { charstring pfcp_local_addr, @@ -584,9 +586,12 @@ return valueof(ts_PFCP_Start_Time(int2oct(f_time_to_ntp32(urr.start_time), 4))); }
-private function f_Session_URR_Duration_Measurement(Session_URR urr) +private function f_Session_URR_Duration_Measurement(inout Session_URR urr) return Duration_Measurement { - return valueof(ts_PFCP_Duration_Measurement(f_time() - urr.start_time)); + var integer now := f_time(); + var integer duration := now - urr.last_report_time; + urr.last_report_time := urr.last_report_time; + return valueof(ts_PFCP_Duration_Measurement(duration)); }
private function f_Session_URR_Usage_Report_Deletion_Response(Session_URR urr) @@ -600,6 +605,18 @@ return valueof(usage_report); }
+private function f_Session_URR_Usage_Report_Report_Request(inout Session_URR urr) +return Usage_Report_Report_Request { + var template (value) Usage_Report_Report_Request usage_report; + usage_report := ts_Usage_Report_Report_Request(urr.urr_id, + urr.ur_seqn, + ts_PFCP_Usage_Report_Trigger(quvti := '1'B), + start_time := f_Session_URR_Start_Time(urr), + end_time := f_End_Time_now(), + duration_measurement := f_Session_URR_Duration_Measurement(urr)); + return valueof(usage_report); +} + function f_pfcp_expect(template (present) PDU_PFCP exp_rx, float wait_time := 5.0) runs on SMF_Session_CT return PDU_PFCP { var PDU_PFCP rx; @@ -622,10 +639,28 @@ return rx; }
+function f_Session_tr_PFCP_Session_Est_Req() runs on SMF_Session_CT return template (present) PDU_PFCP +{ + var template Create_URR_list create_urr := *; + + if (g_pars.gy.validity_time > 0) { + create_urr := { + tr_PFCP_Create_URR(urr_id := ?, + measurement_method := tr_PFCP_Measurement_Method(durat := '1'B), + reporting_triggers := tr_PFCP_Reporting_Triggers(quvti := '1'B), + quota_validity_time := tr_Quota_Validity_Time(g_pars.gy.validity_time), + measurement_information := tr_Measurement_Information(istm := '1'B)) + }; + } + + return tr_PFCP_Session_Est_Req(create_urr := create_urr); +} + private altstep as_pfcp_sess_est_req() runs on SMF_Session_CT { + var template (present) PDU_PFCP exp_req := f_Session_tr_PFCP_Session_Est_Req(); var PDU_PFCP req; - [] PFCP.receive(tr_PFCP_Session_Est_Req()) -> value req { + [] PFCP.receive(exp_req) -> value req { f_pfcp_sess_est_resp(req); } } @@ -669,7 +704,31 @@ PFCP.send(resp); }
-private altstep as_pfcp_sess_del_req(template (value) PFCP_Types.Cause resp_cause := ts_PFCP_Cause(REQUEST_ACCEPTED)) + +function f_Session_tr_PFCP_Session_Mod_Req() runs on SMF_Session_CT return template (present) PDU_PFCP +{ + return tr_PFCP_Session_Mod_Req(g_pars.pfcp_pars.local_f_seid.seid); +} + +altstep as_pfcp_sess_mod_req() +runs on SMF_Session_CT { + var template (present) PDU_PFCP exp_req := f_Session_tr_PFCP_Session_Mod_Req(); + var PDU_PFCP req; + [] PFCP.receive(exp_req) -> value req { + f_pfcp_sess_mod_resp(req); + } +} + +function f_pfcp_sess_mod_resp(PDU_PFCP req) runs on SMF_Session_CT { + var template (value) PDU_PFCP resp; + resp := ts_PFCP_Session_Mod_Resp(seq_nr := req.sequence_number, + seid := g_pars.pfcp_pars.remote_cp_f_seid.seid, + cause := ts_PFCP_Cause(REQUEST_ACCEPTED)); + PFCP.send(resp); +} + + +altstep as_pfcp_sess_del_req(template (value) PFCP_Types.Cause resp_cause := ts_PFCP_Cause(REQUEST_ACCEPTED)) runs on SMF_Session_CT { var PDU_PFCP req; [] PFCP.receive(tr_PFCP_Session_Del_Req(g_pars.pfcp_pars.local_f_seid.seid)) -> value req { @@ -690,4 +749,29 @@ PFCP.send(resp); }
+/* Send a PFCP Session Report Request (Quota Vality Time triggered) */ +function f_pfcp_sess_report_req() runs on SMF_Session_CT { + var template (value) PDU_PFCP req; + var template (omit) Usage_Report_Report_Request_list usage_reports := omit; + for(var integer i := 0; i < lengthof(g_pars.pfcp_pars.urr_list); i := i +1) { + var Session_URR urr := g_pars.pfcp_pars.urr_list[i]; + usage_reports[i] := f_Session_URR_Usage_Report_Report_Request(urr); + } + + req := ts_PFCP_Session_Report_Request(g_pars.pfcp_pars.remote_cp_f_seid.seid, + ts_Report_Type(usar := '1'B), + usage_report := usage_reports) + PFCP.send(req); + as_pfcp_sess_report_resp(); +} + +private altstep as_pfcp_sess_report_resp(template (present) PFCP_Types.Cause resp_cause := tr_PFCP_Cause(REQUEST_ACCEPTED)) +runs on SMF_Session_CT { + var PDU_PFCP resp; + [] PFCP.receive(tr_PFCP_Session_Report_Resp(g_pars.pfcp_pars.local_f_seid.seid, + resp_cause)) -> value resp { + setverdict(pass); + } +} + } diff --git a/smf/SMF_Tests.ttcn b/smf/SMF_Tests.ttcn index 97d4315..6c490ba 100644 --- a/smf/SMF_Tests.ttcn +++ b/smf/SMF_Tests.ttcn @@ -216,7 +216,8 @@ connect(self:PFCP_PROC, vc_PFCP:CLIENT_PROC); f_pfcp_force_assoc_setup_req(ts_PFCP_Node_ID_ipv4(f_inet_addr(mp_pfcp_ip_local)), fail_timeout := true, - up_function_features := ts_PFCP_UP_Function_Features(ftup := '1'B)); + up_function_features := ts_PFCP_UP_Function_Features(ftup := '1'B, + vtime := '1'B)); disconnect(self:PFCP, vc_PFCP:CLIENT); disconnect(self:PFCP_PROC, vc_PFCP:CLIENT_PROC);
@@ -330,14 +331,23 @@
f_s5s8_create_session();
+ f_sleep(int2float(g_pars.gy.validity_time)); + f_pfcp_sess_report_req(); + /* We should receive an update even if no traffic is sent: */ as_DIA_Gy_CCR(UPDATE_REQUEST);
+ /* SMF updates new Volume quota obtaine from OCS on UPF: */ + as_pfcp_sess_mod_req(); + /* Answer next CCR[Update] with CCA Reject: */ g_pars.gy.cca_res_code := DIAMETER_AUTHORIZATION_REJECTED; + f_sleep(int2float(g_pars.gy.validity_time)); + f_pfcp_sess_report_req(); as_DIA_Gy_CCR(UPDATE_REQUEST);
/* Expect SMF to tear down the connection as a result: */ + as_pfcp_sess_del_req(); as_DIA_Gx_CCR(TERMINATION_REQUEST); as_DIA_Gy_CCR(TERMINATION_REQUEST);