Review at  https://gerrit.osmocom.org/6262

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
---
M mgw/MGCP_Test.cfg
M mgw/MGCP_Test.ttcn
2 files changed, 72 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/62/6262/1

diff --git a/mgw/MGCP_Test.cfg b/mgw/MGCP_Test.cfg
index af59a7c..6eeb9c2 100644
--- a/mgw/MGCP_Test.cfg
+++ b/mgw/MGCP_Test.cfg
@@ -26,6 +26,8 @@
 MGCP_Test.TC_crcx_missing_mode
 MGCP_Test.TC_crcx_unsupp_packet_intv
 MGCP_Test.TC_crcx_sdp
+MGCP_Test.TC_crcx_wildcarded
+MGCP_Test.TC_crcx_wildcarded_exhaust
 MGCP_Test.TC_mdcx_without_crcx
 MGCP_Test.TC_dlcx_without_crcx
 MGCP_Test.TC_crcx_and_dlcx_ep_callid_connid
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index bc3f72e..55559cd 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -391,6 +391,74 @@
                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 @@
                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());

-- 
To view, visit https://gerrit.osmocom.org/6262
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I70cf486dc21aef19e4199289f5a5509f6927713e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>

Reply via email to