This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15295 Change subject: sgsn: Proper shutdown of RAN_Adapter components ...................................................................... sgsn: Proper shutdown of RAN_Adapter components Otherwise TTCN3 errors sproadically during shutdown: """" SCCP_Emulation.ttcn:5661 Receive operation on port SCCP_SP_PORT succeeded, message from SGSN_Test_0-RAN(414) ... SCCP_Emulation.ttcn:5293 Sent on MTP3_SCCP_PORT to SGSN_Test_0-M3UA(415) @SCCP_Types.ASP_MTP3_TRANSFERreq_sccp SCCP_Emulation.ttcn:5293 Outgoing message was mapped to @MTP3asp_Types.ASP_MTP3_TRANSFERreq SCCP_Emulation.ttcn:5293 Dynamic test case error: Sending data on the connection of port MTP3_SCCP_PORT to 415:MTP3_SP_PORT failed. (Broken pipe) SCCP_Emulation.ttcn:5293 setverdict(error): none -> error """ Similar shutdown is already done in f_cleanup() of SCCP_Tests.ttcn. Related: OS#4176 Change-Id: I471eb851e5d41de5d8d974ec81be27024d7d313a --- M library/RAN_Adapter.ttcnpp M sgsn/SGSN_Tests.ttcn 2 files changed, 89 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/95/15295/1 diff --git a/library/RAN_Adapter.ttcnpp b/library/RAN_Adapter.ttcnpp index e995e8d..9ed1be1 100644 --- a/library/RAN_Adapter.ttcnpp +++ b/library/RAN_Adapter.ttcnpp @@ -47,9 +47,11 @@ MSC_SCCP_MTP3_parameters sccp_pars, SCCP_PAR_Address sccp_addr_own, SCCP_PAR_Address sccp_addr_peer, + RAN_Transport transport, /* handler mode */ - RAN_Emulation_CT vc_RAN + RAN_Emulation_CT vc_RAN, + boolean vc_RAN_started } type record RAN_Configuration { @@ -79,6 +81,7 @@ }; ba.sccp_addr_own := valueof(ts_SccpAddr_PC_SSN(cfg.own_pc, cfg.own_ssn, cfg.sio, cfg.sccp_service_type)); ba.sccp_addr_peer := valueof(ts_SccpAddr_PC_SSN(cfg.peer_pc, cfg.peer_ssn, cfg.sio, cfg.sccp_service_type)); + ba.transport := cfg.transport; } @@ -177,6 +180,9 @@ } log("Starting RAN_Emulation"); ba.vc_RAN.start(RAN_Emulation.main(valueof(ops), "")); + ba.vc_RAN_started := true; + } else { + ba.vc_RAN_started := false; } @@ -186,5 +192,27 @@ ba.vc_SCCP.start(SCCPStart(ba.sccp_pars)); } +function f_ran_adapter_cleanup(inout RAN_Adapter ba) { + if (ba.vc_RAN_started) { + if (ba.transport == RANAP_TRANSPORT_IuCS) { +#ifdef RAN_EMULATION_RANAP + disconnect(ba.vc_RAN:RANAP, ba.vc_SCCP:SCCP_SP_PORT); +#endif + } else { +#ifdef RAN_EMULATION_BSSAP + disconnect(ba.vc_RAN:BSSAP, ba.vc_SCCP:SCCP_SP_PORT); +#endif + } + ba.vc_RAN.stop; + } + if (ba.transport == BSSAP_TRANSPORT_AoIP or + ba.transport == RANAP_TRANSPORT_IuCS) { + unmap(ba.vc_M3UA:SCTP_PORT, system:sctp); + disconnect(ba.vc_M3UA:MTP3_SP_PORT, ba.vc_SCCP:MTP3_SCCP_PORT); + ba.vc_M3UA.stop; + } + ba.vc_SCCP.stop; +} + } diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn index a7cc57f..a7b3490 100644 --- a/sgsn/SGSN_Tests.ttcn +++ b/sgsn/SGSN_Tests.ttcn @@ -328,6 +328,14 @@ f_vty_enable_echo_interval(g_use_echo); } +function f_cleanup() runs on test_CT { + var integer i; + for (i := 0; i < NUM_RNC; i := i+1) { + f_ran_adapter_cleanup(g_ranap[i]); + } + self.stop; +} + private function RncUnitdataCallback(RANAP_PDU ranap) runs on RAN_Emulation_CT return template RANAP_PDU { var template RANAP_PDU resp := omit; @@ -454,6 +462,7 @@ testcase TC_wait_ns_up() runs on test_CT { f_init(); f_sleep(20.0); + f_cleanup(); } function f_send_llc(template (value) PDU_LLC llc_pdu, integer gb_index := 0) runs on BSSGP_ConnHdlr { @@ -684,6 +693,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb, 1); vc_conn.done; + f_cleanup(); } testcase TC_attach_mnc3() runs on test_CT { @@ -692,6 +702,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb, 1001); vc_conn.done; + f_cleanup(); } private function f_TC_attach_umts_aka_umts_res(charstring id) runs on BSSGP_ConnHdlr { @@ -704,6 +715,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_umts_aka_umts_res), testcasename(), g_gb, 1002); vc_conn.done; + f_cleanup(); } private function f_TC_attach_umts_aka_gsm_sres(charstring id) runs on BSSGP_ConnHdlr { @@ -716,6 +728,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_umts_aka_gsm_sres), testcasename(), g_gb, 1003); vc_conn.done; + f_cleanup(); } /* MS never responds to ID REQ, expect ATTACH REJECT */ @@ -742,6 +755,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_auth_id_timeout), testcasename(), g_gb, 2, 40.0); vc_conn.done; + f_cleanup(); } /* HLR never responds to SAI REQ, expect ATTACH REJECT */ @@ -762,6 +776,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_auth_sai_timeout), testcasename(), g_gb, 3); vc_conn.done; + f_cleanup(); } /* HLR rejects SAI, expect ATTACH REJECT */ @@ -783,6 +798,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_auth_sai_reject), testcasename(), g_gb, 4); vc_conn.done; + f_cleanup(); } /* HLR never responds to UL REQ, expect ATTACH REJECT */ @@ -812,6 +828,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_gsup_lu_timeout), testcasename(), g_gb, 5); vc_conn.done; + f_cleanup(); } /* HLR rejects UL REQ, expect ATTACH REJECT */ @@ -842,6 +859,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_gsup_lu_reject), testcasename(), g_gb, 6); vc_conn.done; + f_cleanup(); } @@ -867,6 +885,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_combined), testcasename(), g_gb, 7); vc_conn.done; + f_cleanup(); } /* Attempt of GPRS ATTACH in 'accept all' mode */ @@ -891,6 +910,7 @@ f_vty_config(SGSNVTY, "sgsn", "auth-policy accept-all"); vc_conn := f_start_handler(refers(f_TC_attach_accept_all), testcasename(), g_gb, 8); vc_conn.done; + f_cleanup(); } /* Attempt of GPRS ATTACH in 'accept all' mode */ @@ -929,6 +949,7 @@ /* test with home IMSI: Must Accept */ vc_conn := f_start_handler(refers(f_TC_attach_accept_all), testcasename(), g_gb, 10); vc_conn.done; + f_cleanup(); } /* Routing Area Update from Unknown TLLI -> REJECT */ @@ -950,6 +971,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_rau_unknown), testcasename(), g_gb, 11); vc_conn.done; + f_cleanup(); } private function f_TC_attach_rau(charstring id) runs on BSSGP_ConnHdlr { @@ -965,6 +987,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_rau), testcasename(), g_gb, 12); vc_conn.done; + f_cleanup(); } /* general GPRS DETACH helper */ @@ -1018,6 +1041,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_detach_unknown_nopoweroff), testcasename(), g_gb, 13); vc_conn.done; + f_cleanup(); } /* IMSI DETACH (power-off) for unknown TLLI */ @@ -1030,6 +1054,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_detach_unknown_poweroff), testcasename(), g_gb, 14); vc_conn.done; + f_cleanup(); } /* IMSI DETACH (non-power-off) for known TLLI */ @@ -1045,6 +1070,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_detach_nopoweroff), testcasename(), g_gb, 15); vc_conn.done; + f_cleanup(); } /* IMSI DETACH (power-off) for known TLLI */ @@ -1060,6 +1086,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_detach_poweroff), testcasename(), g_gb, 16); vc_conn.done; + f_cleanup(); } type record PdpActPars { @@ -1360,6 +1387,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_pdp_act), testcasename(), g_gb, 17); vc_conn.done; + f_cleanup(); } /* PDP Context activation for not-attached subscriber; expect fail */ @@ -1388,6 +1416,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_pdp_act_unattached), testcasename(), g_gb, 18); vc_conn.done; + f_cleanup(); } /* ATTACH + PDP CTX ACT + user plane traffic */ @@ -1407,6 +1436,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user), testcasename(), g_gb, 19); vc_conn.done; + f_cleanup(); } /* ATTACH + PDP CTX ACT; reject from GGSN */ @@ -1426,6 +1456,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_ggsn_reject), testcasename(), g_gb, 20); vc_conn.done; + f_cleanup(); } /* ATTACH + PDP CTX ACT + user plane traffic + PDP CTX DEACT in MO direction */ @@ -1447,6 +1478,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_deact_mo), testcasename(), g_gb, 21); vc_conn.done; + f_cleanup(); } /* ATTACH + PDP CTX ACT + user plane traffic + PDP CTX DEACT in MT direction */ @@ -1468,6 +1500,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_deact_mt), testcasename(), g_gb, 22); vc_conn.done; + f_cleanup(); } /* ATTACH + ATTACH (2nd) */ @@ -1487,6 +1520,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_forget_tlli_attach), testcasename(), g_gb, 22); vc_conn.done; + f_cleanup(); } private function f_TC_attach_restart_ctr_echo(charstring id) runs on BSSGP_ConnHdlr { @@ -1528,6 +1562,7 @@ vc_conn := f_start_handler(refers(f_TC_attach_restart_ctr_echo), testcasename(), g_gb, 23, 30.0); vc_conn.done; g_use_echo := false + f_cleanup(); } private function f_TC_attach_restart_ctr_create(charstring id) runs on BSSGP_ConnHdlr { @@ -1567,6 +1602,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_restart_ctr_create), testcasename(), g_gb, 24, 30.0); vc_conn.done; + f_cleanup(); } /* ATTACH + PDP CTX ACT + user plane traffic + PDP CTX DEACT in MT direction + trigger T3395 */ @@ -1603,6 +1639,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_deact_mt_t3395_expire), testcasename(), g_gb, 25, 60.0); vc_conn.done; + f_cleanup(); } /* ATTACH + PDP CTX ACT dropped + retrans */ @@ -1661,6 +1698,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_deact_gtp_retrans), testcasename(), g_gb, 27); vc_conn.done; + f_cleanup(); } /* Test that SGSN GTP response retransmit queue works fine */ @@ -1720,6 +1758,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_deact_gtp_retrans_resp), testcasename(), g_gb, 28); vc_conn.done; + f_cleanup(); } private function f_TC_hlr_location_cancel_request_update(charstring id) runs on BSSGP_ConnHdlr { @@ -1768,6 +1807,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_error_ind_ggsn), testcasename(), g_gb, 26); vc_conn.done; + f_cleanup(); } testcase TC_hlr_location_cancel_request_update() runs on test_CT { @@ -1780,6 +1820,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_update), testcasename(), g_gb, 31); vc_conn.done; + f_cleanup(); } @@ -1811,6 +1852,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_withdraw), testcasename(), g_gb, 29); vc_conn.done; + f_cleanup(); } @@ -1841,6 +1883,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_unknown_subscriber_withdraw), testcasename(), g_gb, 30); vc_conn.done; + f_cleanup(); } private function f_TC_hlr_location_cancel_request_unknown_subscriber_update(charstring id) runs on BSSGP_ConnHdlr { @@ -1857,6 +1900,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_unknown_subscriber_update), testcasename(), g_gb, 30); vc_conn.done; + f_cleanup(); } private function f_TC_attach_detach_check_subscriber_list(charstring id) runs on BSSGP_ConnHdlr { @@ -1878,6 +1922,7 @@ vc_conn.done; f_vty_transceive_not_match(SGSNVTY, "show subscriber cache", pattern "* IMSI: {imsi}*"); + f_cleanup(); } /* Attempt an attach, but loose the Identification Request (IMEI) */ @@ -1923,6 +1968,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_no_imei_response), testcasename(), g_gb, 32, 60.0); vc_conn.done; + f_cleanup(); } /* Attempt an attach, but loose the Identification Request (IMSI) */ @@ -1971,6 +2017,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_no_imsi_response), testcasename(), g_gb, 35, 60.0); vc_conn.done; + f_cleanup(); } private function f_sgsn_vty_destroy_subscriber_imsi(TELNETasp_PT pt, charstring imsi) { @@ -1992,6 +2039,7 @@ f_vty_transceive_match(SGSNVTY, "show subscriber cache", pattern "* IMSI: {imsi}*"); f_sgsn_vty_destroy_subscriber_imsi(SGSNVTY, imsi); + f_cleanup(); } private function f_TC_attach_closed_imsi_added(charstring id) runs on BSSGP_ConnHdlr { @@ -2054,6 +2102,7 @@ /* test with foreign IMSI: Must Reject */ vc_conn := f_start_handler(refers(f_TC_attach_closed_add_vty), testcasename(), g_gb, 9); vc_conn.done; + f_cleanup(); } /* Attempt an attach, but never answer a Attach Complete */ @@ -2094,6 +2143,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_check_complete_resend), testcasename(), g_gb, 36, 60.0); vc_conn.done; + f_cleanup(); } private function f_routing_area_update(RoutingAreaIdentificationV ra, integer bssgp := 0) runs on BSSGP_ConnHdlr { @@ -2141,6 +2191,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_rau_a_a), testcasename(), g_gb, 37); vc_conn.done; + f_cleanup(); } private function f_TC_attach_rau_a_b(charstring id) runs on BSSGP_ConnHdlr { @@ -2172,6 +2223,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_rau_a_b), testcasename(), g_gb, 38); vc_conn.done; + f_cleanup(); } private function f_TC_attach_gmm_attach_req_while_gmm_attach(charstring id) runs on BSSGP_ConnHdlr { @@ -2244,6 +2296,7 @@ f_vty_config(SGSNVTY, "sgsn", "auth-policy accept-all"); vc_conn := f_start_handler(refers(f_TC_attach_gmm_attach_req_while_gmm_attach), testcasename(), g_gb, 39); vc_conn.done; + f_cleanup(); } private function f_TC_attach_usim_resync(charstring id) runs on BSSGP_ConnHdlr { @@ -2372,6 +2425,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_attach_usim_resync), testcasename(), g_gb, 40); vc_conn.done; + f_cleanup(); } @@ -2389,6 +2443,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_llc_null), testcasename(), g_gb, 41); vc_conn.done; + f_cleanup(); } /* Send LLC SABM to see if the SGSN rejects it properly with DM */ @@ -2405,6 +2460,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_llc_sabm_dm_llgmm), testcasename(), g_gb, 42); vc_conn.done; + f_cleanup(); } /* Send LLC SABM to see if the SGSN rejects it properly with DM */ @@ -2421,6 +2477,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_llc_sabm_dm_ll5), testcasename(), g_gb, 43); vc_conn.done; + f_cleanup(); } /* test XID handshake with empty L3 info: expect empty return (some phones require that, OS#3426 */ @@ -2450,6 +2507,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_xid_empty_l3), testcasename(), g_gb, 44); vc_conn.done; + f_cleanup(); } private function f_TC_xid_n201u(charstring id) runs on BSSGP_ConnHdlr { @@ -2478,6 +2536,7 @@ f_sleep(1.0); vc_conn := f_start_handler(refers(f_TC_xid_n201u), testcasename(), g_gb, 45); vc_conn.done; + f_cleanup(); } private function f_TC_attach_pdp_act_gmm_detach(charstring id) runs on BSSGP_ConnHdlr { @@ -2504,6 +2563,7 @@ f_init(); vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_gmm_detach), testcasename(), g_gb, 26); vc_conn.done; + f_cleanup(); } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15295 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I471eb851e5d41de5d8d974ec81be27024d7d313a Gerrit-Change-Number: 15295 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190827/1b8123c9/attachment.htm>