laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24821 )

Change subject: MGCP_Test: upgrade expected behavior for TC_dlcx_wildcarded
......................................................................

MGCP_Test: upgrade expected behavior for TC_dlcx_wildcarded

The testcase TC_dlcx_wildcarded expect osmo-mgw to reject wildcarded
DLCX requests but osmo-mgw now implements wildcarded DLCX

Depends: osmo-mgw I6d3a74f6087512130d85002348787bffc672de81
Depends: docker-playground I693cc17dbf6836e7a74b34111671b6e589744a63
Change-Id: I61e23e264bc85eb36d07431c7839fb445c110947
Related: SYS#5535
---
M mgw/MGCP_Test.default
M mgw/MGCP_Test.ttcn
M mgw/gen_links.sh
M mgw/regen_makefile.sh
4 files changed, 59 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  daniel: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve



diff --git a/mgw/MGCP_Test.default b/mgw/MGCP_Test.default
index 35f7ed0..54bf9af 100644
--- a/mgw/MGCP_Test.default
+++ b/mgw/MGCP_Test.default
@@ -11,6 +11,15 @@
 *.MGWVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
 *.MGWVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
 *.MGWVTY.PROMPT1 := "OsmoMGW> "
+*.STATSVTY.CTRL_MODE := "client"
+*.STATSVTY.CTRL_HOSTNAME := "127.0.0.1"
+*.STATSVTY.CTRL_PORTNUM := "4243"
+*.STATSVTY.CTRL_LOGIN_SKIPPED := "yes"
+*.STATSVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
+*.STATSVTY.CTRL_READMODE := "buffered"
+*.STATSVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.STATSVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
+*.STATSVTY.PROMPT1 := "OsmoMGW> "

 [MODULE_PARAMETERS]
 mp_local_udp_port := 2727;
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 307f0a8..6990679 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -30,6 +30,10 @@
        import from IP_Types all;
        import from Osmocom_VTY_Functions all;
        import from TELNETasp_PortType all;
+       import from StatsD_Types all;
+       import from StatsD_CodecPort all;
+       import from StatsD_CodecPort_CtrlFunct all;
+       import from StatsD_Checker all;

        const charstring c_mgw_domain := "mgw";
        const charstring c_mgw_ep_rtpbridge := "rtpbridge/";
@@ -37,7 +41,7 @@
        /* any variables declared in the component will be available to
         * all functions that 'run on' the named component, similar to
         * class members in C++ */
-       type component dummy_CT {
+       type component dummy_CT extends StatsD_ConnHdlr {
                port MGCP_CODEC_PT MGCP;
                var boolean initialized := false;
                var ConnectionId g_mgcp_conn_id := -1;
@@ -50,6 +54,8 @@
                port OsmuxEM_CTRL_PT OsmuxEM;

                port TELNETasp_PT MGWVTY;
+
+               var StatsD_Checker_CT vc_STATSD;
        };

        function get_next_trans_id() runs on dummy_CT return MgcpTransId {
@@ -71,6 +77,8 @@
                charstring mp_remote_ipv6 := "::1";
                PortNumber mp_local_rtp_port_base := 10000;
                PortNumber mp_local_osmux_port := 1985;
+               PortNumber mp_mgw_statsd_port := 8125;
+               charstring mp_test_ip := "127.0.0.1";
        }

        private function f_vty_enable_osmux(boolean osmux_on) runs on dummy_CT {
@@ -141,6 +149,11 @@
                                f_osmuxem_init(vc_OsmuxEM);
                                connect(vc_OsmuxEM:CTRL, self:OsmuxEM);
                        }
+
+                       f_init_statsd("VirtCallAgent", vc_STATSD, mp_test_ip, 
mp_mgw_statsd_port);
+                       connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC);
+
+                       f_statsd_reset();
                }

                if (isvalue(ep)) {
@@ -1043,25 +1056,52 @@

        /* test valid wildcarded DLCX */
        testcase TC_dlcx_wildcarded() runs on dummy_CT {
-                /* Note: A wildcarded DLCX is specified, but our MGW does not
-                 * support this feature so we expect the MGW to reject the
-                 * request */
                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) {
+                       cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", 
call_id);
+                       resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK);
+               }
+
+               expect := {
+                       { name := 
"TTCN3.trunk.virtual-0.common.endpoints.used", mtype := "g", min := 
n_endpoints, max := n_endpoints}
+               };
+               f_statsd_expect(expect);
+
+               /* Send wildcarded DLCX */
                var template MgcpResponse rtmpl := {
                        line := {
-                               code := "507",
+                               code := "200",
                                string := ?
                        },
                        params:= { },
                        sdp := omit
                };
+               cmd := ts_DLCX(get_next_trans_id(), ep);
+               mgcp_transceive_mgw(cmd, rtmpl);

-               f_init(ep);
+               /* The stats reporter collects multiple samples during the 
reporting interval and
+                * reports the highest back to the user. This means we will not 
immediately get
+                * the 0 endpoints but an intermediate result instead. */
+               expect := {
+                       { name := 
"TTCN3.trunk.virtual-0.common.endpoints.used", mtype := "g", min := 0, max := 
n_endpoints}
+               };
+               f_statsd_expect(expect);

-               cmd := ts_DLCX(get_next_trans_id(), ep, '41234'H);
-               resp := mgcp_transceive_mgw(cmd, rtmpl);
+               /* The second interval must resturn a result with 0 endpoints 
in use. */
+               expect := {
+                       { name := 
"TTCN3.trunk.virtual-0.common.endpoints.used", mtype := "g", min := 0, max := 0}
+               };
+               f_statsd_expect(expect);
+
                setverdict(pass);
        }

diff --git a/mgw/gen_links.sh b/mgw/gen_links.sh
index 8893954..6ca53a6 100755
--- a/mgw/gen_links.sh
+++ b/mgw/gen_links.sh
@@ -45,6 +45,7 @@
 FILES+="Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn "
 FILES+="Osmocom_VTY_Functions.ttcn "
 FILES+="RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc "
+FILES+="StatsD_Types.ttcn StatsD_CodecPort.ttcn 
StatsD_CodecPort_CtrlFunct.ttcn StatsD_CodecPort_CtrlFunctdef.cc 
StatsD_Checker.ttcn "
 gen_links $DIR $FILES

 ignore_pp_results
diff --git a/mgw/regen_makefile.sh b/mgw/regen_makefile.sh
index 4662933..2368c77 100755
--- a/mgw/regen_makefile.sh
+++ b/mgw/regen_makefile.sh
@@ -1,5 +1,5 @@
 #!/bin/sh

-FILES="*.ttcn SDP_EncDec.cc *.c MGCP_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc RTP_EncDec.cc 
RTP_CodecPort_CtrlFunctDef.cc OSMUX_CodecPort_CtrlFunctDef.cc IuUP_EncDec.cc 
Native_FunctionDefs.cc TELNETasp_PT.cc IP_EncDec.cc "
+FILES="*.ttcn SDP_EncDec.cc *.c MGCP_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc RTP_EncDec.cc 
RTP_CodecPort_CtrlFunctDef.cc OSMUX_CodecPort_CtrlFunctDef.cc IuUP_EncDec.cc 
Native_FunctionDefs.cc TELNETasp_PT.cc IP_EncDec.cc 
StatsD_CodecPort_CtrlFunctdef.cc "

 ../regen-makefile.sh MGCP_Test.ttcn $FILES

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24821
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I61e23e264bc85eb36d07431c7839fb445c110947
Gerrit-Change-Number: 24821
Gerrit-PatchSet: 6
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillm...@sysmocom.de>
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to