pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/29663 )
Change subject: mgw: Avoid hardcoding in test the amount of endpoints configured in osmo-mgw ......................................................................
mgw: Avoid hardcoding in test the amount of endpoints configured in osmo-mgw
Some tests require to match what's configured in osmo-mgw. Let's make it possible to change it through a module parameter. This will be needed for a follow-up patch to test >256 concurrent osmux conns, which will require increasing the number of configured endpoints above that value.
Change-Id: Ia1e5a0b59ba7c49e97c2cf7ee7a009f3827cf36d --- M mgw/MGCP_Test.ttcn 1 file changed, 15 insertions(+), 11 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve laforge: Looks good to me, approved
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn index 859a677..c54fdb4 100644 --- a/mgw/MGCP_Test.ttcn +++ b/mgw/MGCP_Test.ttcn @@ -84,6 +84,8 @@ PortNumber mp_local_osmux_port := 1985; 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; }
private function f_vty_enable_osmux(boolean osmux_on) runs on dummy_CT { @@ -941,18 +943,19 @@ }
/* test valid wildcarded CRCX */ + type record of MgcpEndpoint MgcpEndpointList; testcase TC_crcx_wildcarded_exhaust() runs on dummy_CT { - const integer n_endpoints := 31; var integer i; var template MgcpCommand cmd; var MgcpResponse resp; var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "*@" & c_mgw_domain; var MgcpCallId call_id := '1234'H; - var MgcpEndpoint ep_assigned[n_endpoints]; + var MgcpEndpoint ep_assigned; + var MgcpEndpointList ep_assigned_li := {}; f_init();
/* Exhaust all endpoint resources on the virtual trunk */ - for (i := 0; i < n_endpoints; i := i+1) { + for (i := 0; i < mp_num_endpoints; i := i+1) { cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK);
@@ -962,10 +965,11 @@ var MgcpMessage resp_msg := { response := resp } - if (f_mgcp_find_param(resp_msg, "Z", ep_assigned[i]) == false) { + if (f_mgcp_find_param(resp_msg, "Z", ep_assigned) == false) { setverdict(fail, "No SpecificEndpointName in MGCP response", resp); mtc.stop; } + ep_assigned_li := ep_assigned_li & {ep_assigned} }
/* Try to allocate one more endpoint, which should fail */ @@ -975,8 +979,8 @@ setverdict(pass);
/* clean-up */ - for (i := 0; i < n_endpoints; i := i+1) { - f_dlcx_ok(ep_assigned[i], call_id); + for (i := 0; i < mp_num_endpoints; i := i+1) { + f_dlcx_ok(ep_assigned_li[i], call_id); } setverdict(pass); } @@ -1040,7 +1044,8 @@ testcase TC_dlcx_non_existant_ep() runs on dummy_CT { var template MgcpCommand cmd; var MgcpResponse resp; - var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "AA@" & c_mgw_domain; + var charstring non_existant_ep := hex2str(int2hex(mp_num_endpoints + 1, 4)) + var MgcpEndpoint ep := c_mgw_ep_rtpbridge & non_existant_ep & "@" & c_mgw_domain; var template MgcpResponse rtmpl := { line := { code := ("500"), @@ -1090,14 +1095,13 @@ var template MgcpCommand cmd; var MgcpResponse resp; var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "*@" & c_mgw_domain; - const integer n_endpoints := 31; var integer i; var MgcpCallId call_id := '1234'H; var StatsDExpects expect; f_init(ep);
/* Allocate a few endpoints */ - for (i := 0; i < n_endpoints; i := i+1) { + for (i := 0; i < mp_num_endpoints; i := i+1) { cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); } @@ -1106,7 +1110,7 @@ * occupied endpoints */ f_sleep(1.0) expect := { - { name := "TTCN3.trunk.virtual-0.common.endpoints.used", mtype := "g", min := n_endpoints, max := n_endpoints} + { name := "TTCN3.trunk.virtual-0.common.endpoints.used", mtype := "g", min := mp_num_endpoints, max := mp_num_endpoints} }; f_statsd_expect(expect);
@@ -1125,7 +1129,7 @@ /* Query a the statsd once to ensure that intermediate results are pulled from the * pipeline. The second query (below) will return the actual result. */ expect := { - { name := "TTCN3.trunk.virtual-0.common.endpoints.used", mtype := "g", min := 0, max := n_endpoints} + { name := "TTCN3.trunk.virtual-0.common.endpoints.used", mtype := "g", min := 0, max := mp_num_endpoints} }; f_statsd_expect(expect);