diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2018-02-01 18:28:08 +0100 |
---|---|---|
committer | Philipp Maier <pmaier@sysmocom.de> | 2018-02-02 16:14:37 +0100 |
commit | 5e06ceefbecc55068e317ca03143cae4f91b3d12 (patch) | |
tree | 9137bc5f9728e88f732a2fea7ba190a890ebb83b /mgw/MGCP_Test.ttcn | |
parent | bb7a01c696009ae36307fb5c2abb8e965c3e3ce4 (diff) |
MCGP_Test: Add tests for wildcarded CRCX
The wildcarded CRCX is not tested yet.
- Add a test function that executes a single wildcarded CRCX
request
- Add a test function that exchausts all MGW resources using
wildcarded CRCX requests
Change-Id: I70cf486dc21aef19e4199289f5a5509f6927713e
Diffstat (limited to 'mgw/MGCP_Test.ttcn')
-rw-r--r-- | mgw/MGCP_Test.ttcn | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn index bc3f72e8..55559cd2 100644 --- a/mgw/MGCP_Test.ttcn +++ b/mgw/MGCP_Test.ttcn @@ -391,6 +391,74 @@ module MGCP_Test { setverdict(pass); } + /* test valid wildcarded CRCX */ + testcase TC_crcx_wildcarded() runs on dummy_CT { + 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; + f_init(); + + /* create the connection on the MGW */ + cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); + resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); + extract_conn_id(resp); + + /* extract endpoint name we got assigned by the MGW */ + var MgcpMessage resp_msg := { + response := resp + } + if (f_mgcp_find_param(resp_msg, "Z", ep_assigned) == false) { + setverdict(fail, "No SpecificEndpointName in MGCP response", resp); + } + + /* clean-up */ + f_dlcx_ok(ep_assigned, call_id); + + setverdict(pass); + } + + /* test valid wildcarded CRCX */ + testcase TC_crcx_wildcarded_exhaust() runs on dummy_CT { + const integer n_endpoints := 32; + 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]; + f_init(); + + /* Exhaust all endpoint resources on the virtual trunk */ + for (i := 0; i < n_endpoints; i := i+1) { + cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); + resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK); + + /* Make sure we got a connection id */ + extract_conn_id(resp); + + var MgcpMessage resp_msg := { + response := resp + } + if (f_mgcp_find_param(resp_msg, "Z", ep_assigned[i]) == false) { + setverdict(fail, "No SpecificEndpointName in MGCP response", resp); + } + } + + /* Try to allocate one more endpoint, which should fail */ + cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id); + var template MgcpResponse rtmpl := tr_MgcpResp_Err("403"); + resp := mgcp_transceive_mgw(cmd, rtmpl); + setverdict(pass); + + /* clean-up */ + for (i := 0; i < n_endpoints; i := i+1) { + f_dlcx_ok(ep_assigned[i], call_id); + } + setverdict(pass); + } + /* TODO: various SDP related bits */ @@ -612,6 +680,8 @@ module MGCP_Test { execute(TC_crcx_unsupp_packet_intv()); execute(TC_crcx_illegal_double_lco()); execute(TC_crcx_sdp()); + execute(TC_crcx_wildcarded()); + execute(TC_crcx_wildcarded_exhaust()); execute(TC_mdcx_without_crcx()); execute(TC_dlcx_without_crcx()); execute(TC_crcx_and_dlcx_ep_callid_connid()); |