mgw: Introduce test TC_crcx_osmux_257

Related: SYS#5987
Change-Id: I74e6c760e076fe2547b6297a54524255fb8b
This commit is contained in:
Pau Espin 2022-10-07 10:58:35 +02:00
parent e792887fbb
commit 787e2e4292
3 changed files with 49 additions and 2 deletions

View File

@ -85,7 +85,7 @@ module MGCP_Test {
PortNumber mp_mgw_statsd_port := 8125;
PortNumber mp_mgw_ctrl_port := 4267;
/* Maximum number of available endpoints in osmo-mgw.cfg ("number endpoints"): */
integer mp_num_endpoints := 31;
integer mp_num_endpoints := 300;
}
private function f_vty_enable_osmux(boolean osmux_on) runs on dummy_CT {
@ -1178,6 +1178,51 @@ module MGCP_Test {
setverdict(pass);
}
/* test Creating 257 concurrent osmux conns. It should fail since maximum is 256. */
testcase TC_crcx_osmux_257() runs on dummy_CT {
var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "*@" & c_mgw_domain;
var template MgcpCommand cmd;
var MgcpResponse resp;
var charstring cid_response;
var integer i;
f_init(ep, true);
for (i := 0; i < 256; i := i + 1) {
cmd := ts_CRCX_osmux(get_next_trans_id(), ep, "recvonly", int2hex(i, 4), -1);
resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK_osmux);
extract_conn_id(resp);
/* extract Osmux CID we got assigned by the MGW */
var MgcpMessage resp_msg := {
response := resp
}
if (f_mgcp_find_param(resp_msg, "X-OSMUX", cid_response) == false) {
setverdict(fail, "No Osmux CID in MGCP response", resp);
mtc.stop;
}
/* Make sure response is no wildcard */
if (f_mgcp_osmux_cid_decode(cid_response) == -1) {
setverdict(fail, "Osmux CID in MGCP response contains unexpected wildcard");
mtc.stop;
}
}
/* Now conn num 257, it should fail due to all Osmux conns already allocated: */
cmd := ts_CRCX_osmux(get_next_trans_id(), ep, "recvonly", int2hex(i, 4), -1);
resp := mgcp_transceive_mgw(cmd, tr_MgcpResp_Err("400"));
setverdict(pass);
/* Clean up */
for (i := 0; i < 256; i := i + 1) {
f_dlcx_ok(ep, int2hex(i, 4));
}
}
/* Create one half open connection in receive-only mode. The MGW must accept
* the packets but must not send any. */
testcase TC_one_crcx_receive_only_osmux() runs on dummy_CT {
@ -2851,6 +2896,7 @@ module MGCP_Test {
execute(TC_crcx_osmux_wildcard());
execute(TC_crcx_osmux_fixed());
execute(TC_crcx_osmux_fixed_twice());
execute(TC_crcx_osmux_257());
execute(TC_one_crcx_receive_only_osmux());
execute(TC_one_crcx_loopback_osmux());
execute(TC_two_crcx_and_rtp_osmux());

View File

@ -29,6 +29,7 @@
<testcase classname='MGCP_Test' name='TC_crcx_osmux_wildcard' time='MASKED'/>
<testcase classname='MGCP_Test' name='TC_crcx_osmux_fixed' time='MASKED'/>
<testcase classname='MGCP_Test' name='TC_crcx_osmux_fixed_twice' time='MASKED'/>
<testcase classname='MGCP_Test' name='TC_crcx_osmux_257' time='MASKED'/>
<testcase classname='MGCP_Test' name='TC_one_crcx_receive_only_osmux' time='MASKED'/>
<testcase classname='MGCP_Test' name='TC_one_crcx_loopback_osmux' time='MASKED'/>
<testcase classname='MGCP_Test' name='TC_two_crcx_and_rtp_osmux' time='MASKED'/>

View File

@ -44,7 +44,7 @@ mgcp
sdp audio-payload send-name
conn-timeout 0
loop 0
number endpoints 31
number endpoints 300
allow-transcoding
osmux off
osmux bind-ip 127.0.0.1