Change in osmo-ttcn3-hacks[master]: BSC_Tests: count MGCP operations in as_media
Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9962 ) Change subject: BSC_Tests: count MGCP operations in as_media .. BSC_Tests: count MGCP operations in as_media as_media handles the MGCP interaction for most of the tests. However, it does not make sure if transactions are missing or if too many transactions are performed (e.g. if an SCCP-Lite tests still creates the connections pointing to the core network, even if they must not created by the BSC in this case). So lets make sure that the MGCP transactions are performed as expected by counting them. - Add counters to count CRCX and MDCX transactions - Check those counters after call establishment and handover Change-Id: Ib073b097a840ca3a8ee99c4ed41f59f574191d98 Related: OS#3292 --- M bsc/BSC_Tests.ttcn M bsc/MSC_ConnectionHandler.ttcn 2 files changed, 74 insertions(+), 7 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn index 149d5b7..2897a0b 100644 --- a/bsc/BSC_Tests.ttcn +++ b/bsc/BSC_Tests.ttcn @@ -2122,10 +2122,19 @@ f_vty_handover(0, 0, g_chan_nr, 1); /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ f_rslem_suspend(RSL1_PROC); + + /* From the MGW perspective, a handover is is characterized by +* performing one MDCX operation with the MGW. So we expect to see +* one more MDCX during handover. */ + g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; + alt { [] as_handover(hs); - /* FIXME: somehow determine that the hand-over has completed, by MGCP MDCX? */ } + + /* Check the amount of MGCP transactions is still consistant with the +* test expectation */ + f_check_mgcp_expectations() } testcase TC_ho_int() runs on test_CT { diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn index f38a3e9..ba4d19d 100644 --- a/bsc/MSC_ConnectionHandler.ttcn +++ b/bsc/MSC_ConnectionHandler.ttcn @@ -58,7 +58,10 @@ /* State encapsulating one MGCP Connection */ type record MgcpConnState { - boolean crcx_seen, + integer crcx_seen, /* Counts how many CRCX operations happend */ + integer mdcx_seen, /* Counts how many MDCX operations happend C */ + integer crcx_seen_exp, /* Sets the expected number of CRCX operations */ + integer mdcx_seen_exp, /* Sets the expected number of MDCX operations */ MgcpConnectionId conn_id, charstring mime_type, /* e.g. AMR */ integer sample_rate,/* 8000 */ @@ -115,7 +118,10 @@ g_media.mgcp_conn[i].sample_rate := 8000; g_media.mgcp_conn[i].ptime := 20; g_media.mgcp_conn[i].rtp_pt := enum2int(f_get_mgcp_pt(codecType)); - g_media.mgcp_conn[i].crcx_seen := false; + g_media.mgcp_conn[i].crcx_seen := 0; + g_media.mgcp_conn[i].mdcx_seen := 0; + g_media.mgcp_conn[i].crcx_seen_exp := 0; + g_media.mgcp_conn[i].mdcx_seen_exp := 0; g_media.mgcp_conn[i].conn_id := f_mgcp_alloc_conn_id(); } @@ -129,9 +135,11 @@ } } +/* Helper function to get the next free MGCP connection identifier. We can + * recognize free connection identifiers by the fact that no CRCX happend yet */ private function f_get_free_mgcp_conn() runs on MSC_ConnHdlr return integer { for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) { - if (not g_media.mgcp_conn[i].crcx_seen) { + if (not g_media.mgcp_conn[i].crcx_seen >= 1) { return i; } } @@ -139,9 +147,12 @@ self.stop; } +/* Helper function to pick a specific connection by its cid. Since we reach out + * for a connection that is in-use we also check if there was already exactly + * one CRCX happening on that connection. */ private function f_get_mgcp_conn(MgcpConnectionId cid) runs on MSC_ConnHdlr return integer { for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) { - if (g_media.mgcp_conn[i].conn_id == cid and g_media.mgcp_conn[i].crcx_seen) { + if (g_media.mgcp_conn[i].conn_id == cid and g_media.mgcp_conn[i].crcx_seen == 1) { return i; } } @@ -278,7 +289,7 @@ mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, mgcp_conn.conn_id, sdp); f_mgcp_par_append(mgcp_resp.params, ts_MgcpParSpecEP(g_media.mgcp_ep)); MGCP.send(mgcp_resp); - g_media.mgcp_conn[cid].crcx_seen := true; + g_media.mgcp_conn[cid].crcx_seen := g_media.mgcp_conn[cid].crcx_seen + 1; repeat;
Change in osmo-ttcn3-hacks[master]: BSC_Tests: count MGCP operations in as_media
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/9962 ) Change subject: BSC_Tests: count MGCP operations in as_media .. Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/9962 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ib073b097a840ca3a8ee99c4ed41f59f574191d98 Gerrit-Change-Number: 9962 Gerrit-PatchSet: 1 Gerrit-Owner: dexter Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Comment-Date: Wed, 11 Jul 2018 20:00:44 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-ttcn3-hacks[master]: BSC_Tests: count MGCP operations in as_media
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/9962 Change subject: BSC_Tests: count MGCP operations in as_media .. BSC_Tests: count MGCP operations in as_media as_media handles the MGCP interaction for most of the tests. However, it does not make sure if transactions are missing or if too many transactions are performed (e.g. if an SCCP-Lite tests still creates the connections pointing to the core network, even if they must not created by the BSC in this case). So lets make sure that the MGCP transactions are performed as expected by counting them. - Add counters to count CRCX and MDCX transactions - Check those counters after call establishment and handover Change-Id: Ib073b097a840ca3a8ee99c4ed41f59f574191d98 Related: OS#3292 --- M bsc/BSC_Tests.ttcn M bsc/MSC_ConnectionHandler.ttcn 2 files changed, 74 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/62/9962/1 diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn index 149d5b7..2897a0b 100644 --- a/bsc/BSC_Tests.ttcn +++ b/bsc/BSC_Tests.ttcn @@ -2122,10 +2122,19 @@ f_vty_handover(0, 0, g_chan_nr, 1); /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ f_rslem_suspend(RSL1_PROC); + + /* From the MGW perspective, a handover is is characterized by +* performing one MDCX operation with the MGW. So we expect to see +* one more MDCX during handover. */ + g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; + alt { [] as_handover(hs); - /* FIXME: somehow determine that the hand-over has completed, by MGCP MDCX? */ } + + /* Check the amount of MGCP transactions is still consistant with the +* test expectation */ + f_check_mgcp_expectations() } testcase TC_ho_int() runs on test_CT { diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn index f38a3e9..ba4d19d 100644 --- a/bsc/MSC_ConnectionHandler.ttcn +++ b/bsc/MSC_ConnectionHandler.ttcn @@ -58,7 +58,10 @@ /* State encapsulating one MGCP Connection */ type record MgcpConnState { - boolean crcx_seen, + integer crcx_seen, /* Counts how many CRCX operations happend */ + integer mdcx_seen, /* Counts how many MDCX operations happend C */ + integer crcx_seen_exp, /* Sets the expected number of CRCX operations */ + integer mdcx_seen_exp, /* Sets the expected number of MDCX operations */ MgcpConnectionId conn_id, charstring mime_type, /* e.g. AMR */ integer sample_rate,/* 8000 */ @@ -115,7 +118,10 @@ g_media.mgcp_conn[i].sample_rate := 8000; g_media.mgcp_conn[i].ptime := 20; g_media.mgcp_conn[i].rtp_pt := enum2int(f_get_mgcp_pt(codecType)); - g_media.mgcp_conn[i].crcx_seen := false; + g_media.mgcp_conn[i].crcx_seen := 0; + g_media.mgcp_conn[i].mdcx_seen := 0; + g_media.mgcp_conn[i].crcx_seen_exp := 0; + g_media.mgcp_conn[i].mdcx_seen_exp := 0; g_media.mgcp_conn[i].conn_id := f_mgcp_alloc_conn_id(); } @@ -129,9 +135,11 @@ } } +/* Helper function to get the next free MGCP connection identifier. We can + * recognize free connection identifiers by the fact that no CRCX happend yet */ private function f_get_free_mgcp_conn() runs on MSC_ConnHdlr return integer { for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) { - if (not g_media.mgcp_conn[i].crcx_seen) { + if (not g_media.mgcp_conn[i].crcx_seen >= 1) { return i; } } @@ -139,9 +147,12 @@ self.stop; } +/* Helper function to pick a specific connection by its cid. Since we reach out + * for a connection that is in-use we also check if there was already exactly + * one CRCX happening on that connection. */ private function f_get_mgcp_conn(MgcpConnectionId cid) runs on MSC_ConnHdlr return integer { for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) { - if (g_media.mgcp_conn[i].conn_id == cid and g_media.mgcp_conn[i].crcx_seen) { + if (g_media.mgcp_conn[i].conn_id == cid and g_media.mgcp_conn[i].crcx_seen == 1) { return i; } } @@ -278,7 +289,7 @@ mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, mgcp_conn.conn_id, sdp); f_mgcp_par_append(mgcp_resp.params, ts_MgcpParSpecEP(g_media.mgcp_ep)); MGCP.send(mgcp_resp); - g_media.mgcp_conn[cid].crcx_seen := true; + g_media.mgcp_conn[cid].crcx_seen := g_media.mgcp_conn[cid].crcx_seen + 1; repeat; }