pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41525?usp=email )
Change subject: stp: Introduce tests to validate inaccessible SP scenario ......................................................................
stp: Introduce tests to validate inaccessible SP scenario
Related: OS#6892 Related: libosmo-sigtran.git Change-Id I7e89db3d82374ca03a2e71fb558c7cec9bd651c4 Change-Id: I8aa3aa902eb56c982529d8c79b7f069145b2547d --- M stp/STP_Tests_IPA.ttcn M stp/STP_Tests_M3UA.ttcn M stp/expected-results.xml 3 files changed, 124 insertions(+), 1 deletion(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve
diff --git a/stp/STP_Tests_IPA.ttcn b/stp/STP_Tests_IPA.ttcn index b110228..0a5b56c 100644 --- a/stp/STP_Tests_IPA.ttcn +++ b/stp/STP_Tests_IPA.ttcn @@ -638,6 +638,26 @@ f_tc_combinedlset_loadshare(true); }
+/* test "traffic-mode override" behavior */ +testcase TC_inaccessible_sp() runs on IPA_CT { + var Misc_Helpers.ro_charstring asps := { "ipa-asp-override-sender" }; + var IpaConfigs ipa_configs := ipa_build_configs(asps); + f_init_ipa(ipa_configs := ipa_configs); + + /* bring up the 'sender' side (single ASP in AS) */ + f_connect_ipa(0); + /* Here none of ipa-asp-override-receiver* is brought up on purpose, so test route failure inside IUT. */ + + var octetstring data := f_SCCP_UDT(); + f_IPA_send(0, data); + + /* STP discards the message to be forwarded, since its destination is not accessible. */ + /* FIXME: DUNA doesn't exist in IPA. Sould we probably receive SCCP UDTS here? */ + f_sleep(1.0); + + setverdict(pass); +} + private function f_IPA_ping(integer idx) runs on IPA_CT { var IpaCcmMsgtype ipa_ping_msg := IPAC_MSGT_PING; @@ -753,6 +773,7 @@ execute( TC_unknown_client_dynamic_tmt_loadshare() ); execute( TC_combinedlset_loadshare() ); execute( TC_unknown_client_dynamic_combinedlset_loadshare() ); + execute( TC_inaccessible_sp() );
execute( TC_beat() ); execute( TC_beat_timeout() ); diff --git a/stp/STP_Tests_M3UA.ttcn b/stp/STP_Tests_M3UA.ttcn index ebdb6e1..4716bb4 100644 --- a/stp/STP_Tests_M3UA.ttcn +++ b/stp/STP_Tests_M3UA.ttcn @@ -49,6 +49,12 @@ M3uaConfigs mp_m3ua_configs := {}; integer mp_recovery_timeout_msec := 2000; charstring mp_sccp_service_type := "mtp3_itu"; + + /* Some PC which is known to be inaccessible for the IUT (no route) */ + integer mp_inaccessible_pc := 666; + + /* Network Indicator of the STP (IUT) network: */ + OCT1 mp_ni := '00'O; }
type record M3uaConfig { @@ -183,6 +189,30 @@ return rx; }
+friend function f_M3UA_exp_no(integer idx, template (present) PDU_M3UA msg, + float timeout_val := 5.0, boolean answer_beat := true) +runs on RAW_M3UA_CT return M3UA_RecvFrom { + var M3UA_RecvFrom rx; + timer T := timeout_val; + T.start; + alt { + [] M3UA[idx].receive(t_M3UA_RecvFrom(msg)) -> value rx { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str("Received unexpected M3UA[", idx, "] ", rx)); + } + [answer_beat] as_m3ua_beat_answer(idx); + [] M3UA[idx].receive(t_M3UA_RecvFrom(?)) -> value rx { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str("Received unexpected M3UA[", idx, "] ", rx, + " before timeout expecting no ", msg)); + } + [] T.timeout { + setverdict(pass); + } + } + return rx; +} + /* flush any number of queued messages matching 'msg' */ friend function f_M3UA_flush(integer idx, template (present) PDU_M3UA msg) runs on RAW_M3UA_CT { var M3UA_RecvFrom rx; @@ -669,7 +699,7 @@ /* Test if traffic is routed from idx_tx/pc_tx to idx_rx/pc_rx */ friend function f_test_traffic(integer idx_tx, template (omit) OCT4 rctx_sender, OCT4 pc_tx, integer idx_rx, template (omit) OCT4 rctx_receiver, OCT4 pc_rx, - OCT1 si := '23'O, OCT1 ni := '00'O, OCT1 mp := '00'O, OCT1 sls := '00'O) + OCT1 si := '23'O, OCT1 ni := mp_ni, OCT1 mp := '00'O, OCT1 sls := '00'O) runs on RAW_M3UA_CT { var octetstring data := f_rnd_octstring_rnd_len(100); f_M3UA_send(idx_tx, ts_M3UA_DATA(rctx_sender, @@ -1765,6 +1795,73 @@ f_clear_m3ua(); }
+private function f_tc_inaccessible_sp_duna(integer idx_tx, OCT4 pc_sender, OCT4 rctx_sender, + OCT4 pc_receiver, OCT4 rctx_receiver) runs on RAW_M3UA_CT { + var octetstring data := f_rnd_octstring_rnd_len(100); + var template (value) M3UA_Protocol_Data m3ua_data; + /* Max for T8 is 1200 msec, so we leave some more time. to avodi race conditions: */ + const float c_t8_max_sec := 1.2 + 0.5; + + /* bring up the sender specifying a routing context */ + f_M3UA_asp_up_act(idx_tx, rctx := rctx_sender); + + /* check if DATA is accepted without Routing Context IE */ + m3ua_data := ts_M3UA_protocol_data(pc_sender, pc_receiver, si:= '23'O, ni := mp_ni, + mp := '00'O, sls := '00'O, data := data); + f_M3UA_send(idx_tx, ts_M3UA_DATA(rctx_sender, m3ua_data), 1); + f_M3UA_exp(idx_tx, tr_M3UA_DUNA({ts_M3UA_PC(oct2int(pc_receiver), 0)}, rctx_sender)); + + /* Test Q.704 timer T8: After we received the first DUNA, if we send another message we + * shouldn't receive another DUNA until T8 times out. Max for T8 is 1200, so we leave + * some more time. */ + f_M3UA_send(idx_tx, ts_M3UA_DATA(rctx_sender, m3ua_data), 1); + f_M3UA_exp_no(idx_tx, tr_M3UA_DUNA({ts_M3UA_PC(oct2int(pc_receiver), 0)}, rctx_sender), + timeout_val := c_t8_max_sec); + + /* After T8, we should receive again a DUNA: */ + f_M3UA_send(idx_tx, ts_M3UA_DATA(rctx_sender, m3ua_data), 1); + f_M3UA_exp(idx_tx, tr_M3UA_DUNA({ts_M3UA_PC(oct2int(pc_receiver), 0)}, rctx_sender)); + + /* Let T8 time out again: */ + f_M3UA_send(idx_tx, ts_M3UA_DATA(rctx_sender, m3ua_data), 1); + f_M3UA_exp_no(idx_tx, tr_M3UA_DUNA({ts_M3UA_PC(oct2int(pc_receiver), 0)}, rctx_sender), + timeout_val := c_t8_max_sec); + + + f_clear_m3ua(); +} + +/* test whether the STP sends back a M3UA DUNA when receiving a pkt towards an inaccessible SP (non existing/routable PC) */ +testcase TC_inaccessible_sp_duna() runs on RAW_M3UA_CT { + var Misc_Helpers.ro_charstring asps := { "asp-sender" }; + var M3uaConfigs m3ua_configs := m3ua_build_configs(asps); + var OCT4 rctx_sender := int2oct(m3ua_configs[0].routing_ctx, 4); + var OCT4 pc_sender := int2oct(m3ua_configs[0].point_code, 4); + var OCT4 rctx_receiver := int2oct(3, 4); + var OCT4 pc_receiver := int2oct(mp_inaccessible_pc, 4); + + f_init_m3ua(m3ua_configs := m3ua_configs); + + /* bring up the sender specifying a routing context */ + f_tc_inaccessible_sp_duna(0, pc_sender, rctx_sender, pc_receiver, rctx_receiver); +} + +/* test whether the STP sends back a M3UA DUNA when receiving a pkt towards an + * inaccessible SP (PC/AS known but no active ASPs towards it). */ +testcase TC_inaccessible_sp_duna2() runs on RAW_M3UA_CT { + var Misc_Helpers.ro_charstring asps := { "asp-sender", "asp-receiver0" }; + var M3uaConfigs m3ua_configs := m3ua_build_configs(asps); + var OCT4 rctx_sender := int2oct(m3ua_configs[0].routing_ctx, 4); + var OCT4 pc_sender := int2oct(m3ua_configs[0].point_code, 4); + var OCT4 rctx_receiver := int2oct(m3ua_configs[1].routing_ctx, 4); + var OCT4 pc_receiver := int2oct(m3ua_configs[1].point_code, 4); + + f_init_m3ua(m3ua_configs := m3ua_configs); + + /* bring up the sender specifying a routing context */ + f_tc_inaccessible_sp_duna(0, pc_sender, rctx_sender, pc_receiver, rctx_receiver); +} + control { /* M3UA Tests */ execute( TC_connect_asp_up() ); @@ -1782,6 +1879,8 @@ execute( TC_act_rctx_data_no_rctx() ); execute( TC_m3ua_sctp_srv_adm_shutdown() ); execute( TC_combinedlset_loadshare() ); + execute( TC_inaccessible_sp_duna() ); + execute( TC_inaccessible_sp_duna2() );
/* M3UA RKM tests */ execute( TC_rkm_reg_static_notpermitted() ); diff --git a/stp/expected-results.xml b/stp/expected-results.xml index e0170de..5834abb 100644 --- a/stp/expected-results.xml +++ b/stp/expected-results.xml @@ -15,6 +15,8 @@ <testcase classname='STP_Tests_M3UA' name='TC_act_rctx_data_no_rctx' time='MASKED'/> <testcase classname='STP_Tests_M3UA' name='TC_m3ua_sctp_srv_adm_shutdown' time='MASKED'/> <testcase classname='STP_Tests_M3UA' name='TC_combinedlset_loadshare' time='MASKED'/> + <testcase classname='STP_Tests_M3UA' name='TC_inaccessible_sp_duna' time='MASKED'/> + <testcase classname='STP_Tests_M3UA' name='TC_inaccessible_sp_duna2' time='MASKED'/> <testcase classname='STP_Tests_M3UA' name='TC_rkm_reg_static_notpermitted' time='MASKED'/> <testcase classname='STP_Tests_M3UA' name='TC_rkm_reg_static_permitted' time='MASKED'/> <testcase classname='STP_Tests_M3UA' name='TC_rkm_reg_dynamic_permitted' time='MASKED'/> @@ -61,6 +63,7 @@ <testcase classname='STP_Tests_IPA' name='TC_unknown_client_dynamic_tmt_loadshare' time='MASKED'/> <testcase classname='STP_Tests_IPA' name='TC_combinedlset_loadshare' time='MASKED'/> <testcase classname='STP_Tests_IPA' name='TC_unknown_client_dynamic_combinedlset_loadshare' time='MASKED'/> + <testcase classname='STP_Tests_IPA' name='TC_inaccessible_sp' time='MASKED'/> <testcase classname='STP_Tests_IPA' name='TC_beat' time='MASKED'/> <testcase classname='STP_Tests_IPA' name='TC_beat_timeout' time='MASKED'/> <testcase classname='STP_Tests_IPA' name='TC_clnt_beat_timeout' time='MASKED'/>