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

mgw: add constants for mgw endpoint and domain name

The testcase for osmo-mgw hardcodes the mgw domain and also lacks
an endpoint identifier, which was deprecated recently.

- replace the hardcoded occurrences of the mgw domain name with
  a constant

- add a constant for the rtpbridge endpoint identifier

- add a testcase that still uses the old method without prefix
  on the endpoint identifier.

Change-Id: If4455c4cb521270b2fe24881ade9b578a5132205
---
M mgw/MGCP_Test.cfg
M mgw/MGCP_Test.ttcn
2 files changed, 38 insertions(+), 24 deletions(-)


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

diff --git a/mgw/MGCP_Test.cfg b/mgw/MGCP_Test.cfg
index 00e3d7c..af59a7c 100644
--- a/mgw/MGCP_Test.cfg
+++ b/mgw/MGCP_Test.cfg
@@ -18,6 +18,7 @@
 [EXECUTE]
 #MGCP_Test.TC_selftest
 MGCP_Test.TC_crcx
+MGCP_Test.TC_crcx_noprefix
 MGCP_Test.TC_crcx_unsupp_mode
 MGCP_Test.TC_crcx_early_bidir_mode
 MGCP_Test.TC_crcx_unsupp_param
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 516944a..bc3f72e 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -10,6 +10,9 @@
        import from RTP_Endpoint all;
        import from IPL4asp_Types all;
 
+       const charstring c_mgw_domain := "mgw";
+       const charstring c_mgw_ep_rtpbridge := "rtpbridge/";
+
        /* any variables declared in the component will be available to
         * all functions that 'run on' the named component, similar to
         * class members in C++ */
@@ -75,7 +78,7 @@
 
        testcase TC_selftest() runs on dummy_CT {
                const charstring c_auep := "AUEP 158663169 
ds/e1-1/2@172.16.6.66 MGCP 1.0\r\n";
-               const charstring c_mdcx3 := "MDCX 18983215 1@mgw MGCP 1.0\r\n";
+               const charstring c_mdcx3 := "MDCX 18983215 " & 
c_mgw_ep_rtpbridge & "1@" & c_mgw_domain & " MGCP 1.0\r\n";
                const charstring c_mdcx3_ret := "200 18983215 OK\r\n" &
                                                "I: 1\n" &
                                                "\n" &
@@ -87,7 +90,7 @@
                                                "m=audio 0 RTP/AVP 126\r\n" &
                                                "a=rtpmap:126 AMR/8000\r\n" &
                                                "a=ptime:20\r\n";
-               const charstring c_mdcx4 :=     "MDCX 18983216 1@mgw MGCP 
1.0\r\n" &
+               const charstring c_mdcx4 :=     "MDCX 18983216 " & 
c_mgw_ep_rtpbridge & "1@" & c_mgw_domain & " MGCP 1.0\r\n" &
                                                "M: sendrecv\r" &
                                                "C: 2\r\n" &
                                                "I: 1\r\n" &
@@ -115,8 +118,8 @@
                log(c_mdcx4);
                log(dec_MgcpCommand(c_mdcx4));
 
-               log(ts_CRCX("23", "42@mgw", "sendrecv", '1234'H));
-               log(enc_MgcpCommand(valueof(ts_CRCX("23", "42@mgw", "sendrecv", 
'1234'H))));
+               log(ts_CRCX("23", c_mgw_ep_rtpbridge & "42@" & c_mgw_domain, 
"sendrecv", '1234'H));
+               log(enc_MgcpCommand(valueof(ts_CRCX("23", c_mgw_ep_rtpbridge & 
"42@" & c_mgw_domain, "sendrecv", '1234'H))));
 
                log(c_crcx510_ret);
                log(dec_MgcpResponse(c_crcx510_ret));
@@ -221,11 +224,10 @@
                f_dlcx(ep, ?, *, call_id, conn_id);
        }
 
-       /* test valid CRCX without SDP */
-       testcase TC_crcx() runs on dummy_CT {
+       function f_crcx(charstring ep_prefix) runs on dummy_CT {
+               var MgcpEndpoint ep := ep_prefix & "2@" & c_mgw_domain;
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "2@mgw";
                var MgcpCallId call_id := '1234'H;
 
                f_init(ep);
@@ -237,7 +239,17 @@
 
                /* clean-up */
                f_dlcx_ok(ep, call_id);
+       }
 
+       /* test valid CRCX without SDP */
+       testcase TC_crcx() runs on dummy_CT {
+               f_crcx(c_mgw_ep_rtpbridge);
+               setverdict(pass);
+       }
+
+       /* test valid CRCX without SDP (older method without endpoint prefix) */
+       testcase TC_crcx_noprefix() runs on dummy_CT {
+               f_crcx("");
                setverdict(pass);
        }
 
@@ -245,7 +257,7 @@
        testcase TC_crcx_unsupp_mode() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "2@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
                var MgcpCallId call_id := '1233'H;
                var template MgcpResponse rtmpl := tr_MgcpResp_Err("517");
 
@@ -262,7 +274,7 @@
        testcase TC_crcx_early_bidir_mode() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "2@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
                var MgcpCallId call_id := '1232'H;
                var template MgcpResponse rtmpl := tr_MgcpResp_Err("527");
 
@@ -277,7 +289,7 @@
        testcase TC_crcx_unsupp_param() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "2@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
                var MgcpCallId call_id := '1231'H;
                var template MgcpResponse rtmpl := tr_MgcpResp_Err("539");
 
@@ -295,7 +307,7 @@
        testcase TC_crcx_missing_callid() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "2@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
                var template MgcpResponse rtmpl := 
tr_MgcpResp_Err(("400","516"));
 
                f_init(ep);
@@ -314,7 +326,7 @@
        testcase TC_crcx_missing_mode() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "2@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
                var MgcpCallId call_id := '1229'H;
                var template MgcpResponse rtmpl := 
tr_MgcpResp_Err(("400","517"));
 
@@ -333,7 +345,7 @@
        testcase TC_crcx_unsupp_packet_intv() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "2@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
                var MgcpCallId call_id := '1228'H;
                var template MgcpResponse rtmpl := tr_MgcpResp_Err("535");
 
@@ -349,7 +361,7 @@
        testcase TC_crcx_illegal_double_lco() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "2@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
                var MgcpCallId call_id := '1227'H;
                var template MgcpResponse rtmpl := tr_MgcpResp_Err("524");
 
@@ -366,7 +378,7 @@
        testcase TC_crcx_sdp() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "2@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
                var MgcpCallId call_id := '1226'H;
 
                f_init(ep);
@@ -391,7 +403,7 @@
        testcase TC_mdcx_without_crcx() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "3@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "3@" & c_mgw_domain;
                var MgcpCallId call_id := '1225'H;
                var template MgcpResponse rtmpl := {
                        line := {
@@ -417,7 +429,7 @@
        testcase TC_dlcx_without_crcx() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "4@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "4@" & c_mgw_domain;
                var template MgcpResponse rtmpl := {
                        line := {
                                code := ("400", "515"),
@@ -438,7 +450,7 @@
        testcase TC_crcx_and_dlcx_ep_callid_connid() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "5@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain;
                var MgcpCallId call_id := '51234'H;
 
                f_init(ep);
@@ -471,7 +483,7 @@
                f_init();
 
                for (ep_nr := 1; ep_nr < 30; ep_nr := ep_nr+1) {
-                       ep := hex2str(int2hex(ep_nr, 2)) & "@mgw";
+                       ep := c_mgw_ep_rtpbridge & hex2str(int2hex(ep_nr, 2)) & 
"@" & c_mgw_domain;
                        call_id := int2hex(ep_nr, 2) & '1234'H;
                        f_crcx_and_dlcx_ep_callid_connid(ep, call_id);
                }
@@ -481,7 +493,7 @@
        testcase TC_crcx_and_dlcx_ep_callid() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "5@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain;
                var MgcpCallId call_id := '51233'H;
 
                f_init(ep);
@@ -498,7 +510,7 @@
        testcase TC_crcx_and_dlcx_ep() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "5@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain;
                var MgcpCallId call_id := '51232'H;
 
                f_init(ep);
@@ -516,7 +528,7 @@
        testcase TC_crcx_and_dlcx_ep_callid_inval() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "5@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain;
                var MgcpCallId call_id := '51231'H;
 
                f_init(ep);
@@ -534,7 +546,7 @@
        testcase TC_crcx_and_dlcx_ep_callid_connid_inval() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "5@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain;
                var MgcpCallId call_id := '51230'H;
 
                f_init(ep);
@@ -552,7 +564,7 @@
        testcase TC_crcx_and_dlcx_retrans() runs on dummy_CT {
                var template MgcpCommand cmd;
                var MgcpResponse resp;
-               var MgcpEndpoint ep := "5@mgw";
+               var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "5@" & c_mgw_domain;
                var MgcpCallId call_id := '51229'H;
                var template MgcpResponse rtmpl := {
                        line := {
@@ -591,6 +603,7 @@
        control {
                execute(TC_selftest());
                execute(TC_crcx());
+               execute(TC_crcx_noprefix());
                execute(TC_crcx_unsupp_mode());
                execute(TC_crcx_early_bidir_mode());
                execute(TC_crcx_unsupp_param());

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

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

Reply via email to