pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36085?usp=email )
Change subject: pgw: Introduce test TC_s2b_createSession_v4_apco ......................................................................
pgw: Introduce test TC_s2b_createSession_v4_apco
Make sure APCO IE is properly handled and answered back.
Change-Id: Ib01fe0512866924a5afc4d6719ceacb0b4b54df2 --- M library/GTPv2_Templates.ttcn M pgw/PGW_Tests.ttcn M pgw/expected-results.xml 3 files changed, 54 insertions(+), 12 deletions(-)
Approvals: osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified
diff --git a/library/GTPv2_Templates.ttcn b/library/GTPv2_Templates.ttcn index c842230..a86145d 100644 --- a/library/GTPv2_Templates.ttcn +++ b/library/GTPv2_Templates.ttcn @@ -902,7 +902,8 @@ template (omit) FullyQualifiedTEID_List teid_list, template (value) OCT2 chg_car, template (value) uint4_t bearer_id, template (omit) UserLocationInfo uli := omit, - template (value) Bearer_QoS qos := ts_GTP2C_BearerQos('09'O, 0,0,0,0)) := + template (value) Bearer_QoS qos := ts_GTP2C_BearerQos('09'O, 0,0,0,0), + template (omit) APCO apco := omit) := ts_PDU_GTP2C('00000000'O, '000000'O, '20'O, { createSessionRequest := { iMSI := ts_GTP2C_Imsi(imsi), @@ -948,7 +949,7 @@ signallingPriorityIndication := omit, iP_Addr := omit, portNumber := omit, - aPCO := omit, + aPCO := apco, trustedWLANAccessNetworkIdentifier := omit, cNOperatorSelectionEntity := omit, presenceReportingAreaInformation := omit, @@ -1061,7 +1062,8 @@ template FullyQualifiedTEID_List fteids := *, template PDN_AddressAllocation addr := *, template APN_Restriction apn_restriction := *, - template BearerContextGrouped_List bctxg := *) := + template BearerContextGrouped_List bctxg := *, + template APCO exp_apco := *) := tr_PDU_GTP2C(d_teid, seq, { createSessionResponse := { cause := tr_GTP2C_Cause(cause), @@ -1081,7 +1083,7 @@ csid := *, lDN := *, pGW_Back_OffTime := *, - aPCO := *, + aPCO := exp_apco, trustedWLANIPv4Parameters := *, indicationFlags := *, presenceReportingAreaAction := *, diff --git a/pgw/PGW_Tests.ttcn b/pgw/PGW_Tests.ttcn index e39bd62..ea9f056 100644 --- a/pgw/PGW_Tests.ttcn +++ b/pgw/PGW_Tests.ttcn @@ -676,7 +676,9 @@ /* create a session on the PGW */ private function f_create_session(template (value) FullyQualifiedTEID fteid_c_ie, template (value) FullyQualifiedTEID fteid_u_ie, - template (omit) UserLocationInfo uli_ie := omit) runs on PGW_Session_CT { + template (omit) UserLocationInfo uli_ie := omit, + template (omit) APCO apco := omit, + template APCO exp_apco := *) runs on PGW_Session_CT { var PDU_GTPCv2 rx;
/* Defaults used for s5/s8: */ @@ -698,7 +700,8 @@ teid_list := { fteid_u_ie }, chg_car := '0000'O, bearer_id := g_pars.bearer.ebi, - uli := uli_ie); + uli := uli_ie, + apco := apco); g2c.gtpcv2_pdu.createSessionRequest.servingNetwork := ts_GTP2C_ServingNetwork('001'H, '01F'H);
GTP2.send(g2c); @@ -715,7 +718,8 @@ alt { [] GTP2.receive(tr_GTP2C_CreateSessionResp(d_teid := g_pars.teic_local, cause := Request_accepted, - apn_restriction := apn_restriction)) -> value rx { + apn_restriction := apn_restriction, + exp_apco := exp_apco)) -> value rx { /* extract TEIDs */ var CreateSessionResponse resp := rx.gtpcv2_pdu.createSessionResponse; g_pars.teic_remote := resp.fullyQualifiedTEID[0].tEID_GRE_Key; @@ -780,7 +784,8 @@ }
/* create a session on the PGW on a S2b interface (from ePDG)*/ -private function f_s2b_create_session() runs on PGW_Session_CT { +private function f_s2b_create_session(template (omit) APCO apco := omit, + template APCO exp_apco := *) runs on PGW_Session_CT { var template (value) FullyQualifiedTEID fteid_c_ie, fteid_u_ie; var template (value) UserLocationInfo uli_ie;
@@ -788,13 +793,12 @@ f_inet_addr(mp_local_hostname_c), omit); fteid_u_ie := ts_GTP2C_FTEID(FTEID_IF_S2bU_ePDG_GTPU, g_pars.bearer.teid_local, 5, f_inet_addr(mp_local_hostname_u), omit); - f_create_session(fteid_c_ie, fteid_u_ie); - /* open5gs up to 1.2.3 won't accept it without ULI, despite not mandatory */ + var template (value) TAI tai := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0001'O }; var template (value) ECGI ecgi := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0'H, 23 }; uli_ie := ts_GTP2C_UserLocInfo(tai := tai, ecgi := ecgi);
- f_create_session(fteid_c_ie, fteid_u_ie, uli_ie); + f_create_session(fteid_c_ie, fteid_u_ie, uli_ie := uli_ie, apco := apco, exp_apco := exp_apco);
}
@@ -1048,7 +1052,9 @@
/* create a session, expect it to succeed */ private function f_TC_s2b_createSession_v4_noapco() runs on PGW_Session_CT { - f_s2b_create_session(); + var template (omit) APCO apco := omit; + var template APCO exp_apco := omit; + f_s2b_create_session(apco, exp_apco); setverdict(pass); } testcase TC_s2b_createSession_v4_noapco() runs on PGW_Test_CT { @@ -1061,6 +1067,27 @@ vc_conn.done; }
+private function f_TC_s2b_createSession_v4_apco() runs on PGW_Session_CT { + var template (omit) APCO apco := ts_GTP2C_APCO('0000'B, + {ts_GTP2C_PCO_P_DNS_IPv4(''O), + ts_GTP2C_PCO_P_PCSCF_IPv4(''O)}); + var template APCO exp_apco := tr_GTP2C_APCO('0000'B, + {tr_GTP2C_PCO_P_DNS_IPv4(?), + *, /* open5gs-smfd can contain several DNS servers */ + tr_GTP2C_PCO_P_PCSCF_IPv4(?)}); + f_s2b_create_session(apco, exp_apco); + setverdict(pass); +} +testcase TC_s2b_createSession_v4_apco() runs on PGW_Test_CT { + var PGW_Session_CT vc_conn; + var SessionPars pars := valueof(t_SessionPars('001010123456789'H, + "tun22", + rat_type := GTP2C_RAT_WLAN)); + f_init(); + vc_conn := f_start_handler(refers(f_TC_s2b_createSession_v4_apco), pars); + vc_conn.done; +} + control { execute( TC_tx_echo() ); execute( TC_createSession() ); @@ -1070,6 +1097,7 @@ execute( TC_deleteSession_unknown() ); execute( TC_gy_charging_cc_time() ); execute( TC_s2b_createSession_v4_noapco() ); + execute( TC_s2b_createSession_v4_apco() ); }
diff --git a/pgw/expected-results.xml b/pgw/expected-results.xml index 0e252af..35d0ce9 100644 --- a/pgw/expected-results.xml +++ b/pgw/expected-results.xml @@ -8,4 +8,5 @@ <testcase classname='PGW_Tests' name='TC_deleteSession_unknown' time='MASKED'/> <testcase classname='PGW_Tests' name='TC_gy_charging_cc_time' time='MASKED'/> <testcase classname='PGW_Tests' name='TC_s2b_createSession_v4_noapco' time='MASKED'/> + <testcase classname='PGW_Tests' name='TC_s2b_createSession_v4_apco' time='MASKED'/> </testsuite>