Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/14121


Change subject: msc: Introduce Osmux infra and one test for osmo-msc
......................................................................

msc: Introduce Osmux infra and one test for osmo-msc

Change-Id: Ibcb82d1a2d570c6c0ad0c3b6504bffe2244eccd9
---
M library/MGCP_Templates.ttcn
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
3 files changed, 127 insertions(+), 24 deletions(-)



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

diff --git a/library/MGCP_Templates.ttcn b/library/MGCP_Templates.ttcn
index fe2863d..056e390 100644
--- a/library/MGCP_Templates.ttcn
+++ b/library/MGCP_Templates.ttcn
@@ -198,6 +198,7 @@
        }

        template MgcpResponse ts_MDCX_ACK(MgcpTransId trans_id, 
MgcpConnectionId conn_id, template SDP_Message sdp := omit) := 
ts_CRCX_ACK(trans_id, conn_id, sdp);
+       template MgcpResponse ts_MDCX_ACK_osmux(MgcpTransId trans_id, 
MgcpConnectionId conn_id, MgcpOsmuxCID osmux_cid, template SDP_Message sdp := 
omit) := ts_CRCX_ACK_osmux(trans_id, conn_id, osmux_cid, sdp);

        /* have a function that generates a template, rather than a template in 
order to handle
         * optional parameters */
diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 796b0ce..f83407a 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -83,7 +83,8 @@
        boolean gsup_enable,
        integer ran_idx,
        boolean use_umts_aka,
-       boolean ran_is_geran
+       boolean ran_is_geran,
+       boolean use_osmux
 };

 /* get a one-octet bitmaks of supported algorithms based on Classmark 
information */
@@ -172,9 +173,9 @@

        log("BSSMAP_BscUnitdataCallback");
        /* answer all RESET with RESET ACK */
-       if (match(bssap, tr_BSSMAP_Reset)){
+       if (match(bssap, tr_BSSMAP_Reset(g_ran_ops.use_osmux))){
                log("BSSMAP_BscUnitdataCallback: Responding to RESET with 
RESET-ACK");
-               resp := ts_BSSMAP_ResetAck;
+               resp := ts_BSSMAP_ResetAck(g_ran_ops.use_osmux);
        }

        /* FIXME: Handle paging, etc. */
@@ -187,7 +188,7 @@

        log("RANAP_RncUnitdataCallback");
        /* answer all RESET with RESET ACK */
-       if (match(ranap, tr_RANAP_Reset)) {
+       if (match(ranap, tr_RANAP_Reset())) {
                log("RANAP_RncUnitdataCallback: Responding to RESET with 
RESET-ACK");
                var CN_DomainIndicator dom;
                dom := 
ranap.initiatingMessage.value_.Reset.protocolIEs[1].value_.cN_DomainIndicator;
@@ -209,6 +210,7 @@
        decode_dtap := true,
        role_ms := true,
        protocol := RAN_PROTOCOL_BSSAP,
+       use_osmux := false,
        sccp_addr_local := omit,
        sccp_addr_peer := omit
 }
@@ -592,7 +594,9 @@
        MgcpCallId mgcp_call_id optional,               /* MGCP Call ID; 
CallAgent allocated */
        MgcpEndpoint mgcp_ep optional                   /* MGCP Endpoint, 
CallAgent or MGW allocated */,
        MgcpConnectionId mgcp_connection_id_bss,        /* MGCP Connection ID 
BSS Side */
-       MgcpConnectionId mgcp_connection_id_mss         /* MGCP Connection ID 
MSS Side */
+       MgcpConnectionId mgcp_connection_id_mss,        /* MGCP Connection ID 
MSS Side */
+
+       boolean use_osmux                               /* MSC is expected to 
use Osmux for this call */
 }

 template (value) CallParameters t_CallParams(hexstring called, integer tid) := 
{
@@ -617,7 +621,8 @@
        mgcp_call_id := omit,
        mgcp_ep := omit,
        mgcp_connection_id_bss := '0'H,//
-       mgcp_connection_id_mss := '0'H //
+       mgcp_connection_id_mss := '0'H,//
+       use_osmux := false
 };

 /* Allocate a call reference and send SETUP via MNCC to MSC */
@@ -642,6 +647,9 @@
 runs on BSC_ConnHdlr {
        var MNCC_PDU mncc;
        var MgcpCommand mgcp_cmd;
+       var template MgcpResponse mgcp_resp;
+       var MgcpOsmuxCID osmux_cid;
+       var PDU_BSSAP bssap;

        f_ran_register_imsi(g_pars.imsi, g_pars.tmsi);

@@ -681,8 +689,19 @@
                                                        { 
valueof(ts_SDP_rtpmap(cpars.rtp_payload_type,
                                                                                
cpars.rtp_sdp_format)),
                                                          
valueof(ts_SDP_ptime(20)) }));
-               var template MgcpResponse mgcp_resp;
-               mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, 
cpars.mgcp_connection_id_bss, sdp);
+
+               if (cpars.use_osmux) {
+                       osmux_cid := f_MgcpCmd_extract_osmux_cid(mgcp_cmd);
+                       if (osmux_cid != -1) { /* we expect MSC to use wildcard 
here */
+                               setverdict(fail, "MSC using unexpected CID " & 
int2str(osmux_cid) & " != -1");
+                               mtc.stop;
+                       }
+                       osmux_cid := 0;
+                       mgcp_resp := ts_CRCX_ACK_osmux(mgcp_cmd.line.trans_id, 
cpars.mgcp_connection_id_bss, osmux_cid, sdp);
+               } else {
+                       mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, 
cpars.mgcp_connection_id_bss, sdp);
+               }
+
                f_mgcp_par_append(mgcp_resp.params, 
ts_MgcpParSpecEP(cpars.mgcp_ep));
                MGCP.send(mgcp_resp);
                }
@@ -706,15 +725,30 @@
                        }
 
                /* expect the MSC to trigger a BSSMAP ASSIGNMENT */
-               [] BSSAP.receive(tr_BSSMAP_AssignmentReq(omit, tla_ass)) {
+               [] BSSAP.receive(tr_BSSMAP_AssignmentReq(omit, tla_ass)) -> 
value bssap {
                        var BSSMAP_IE_AoIP_TransportLayerAddress tla;
                        var BSSMAP_IE_SpeechCodec codec;
+                       var BSSMAP_IE_Osmo_OsmuxCID osmuxCID;
                        log("f_mt_call_complete 6");

                        tla := 
valueof(ts_BSSMAP_IE_AoIP_TLA4(f_inet_addr(cpars.bss_rtp_ip), 
cpars.bss_rtp_port));
                        codec := 
valueof(ts_BSSMAP_IE_SpeechCodec({ts_CodecFR}));

-                       BSSAP.send(ts_BSSMAP_AssignmentComplete(omit, tla, 
codec));
+                       if (cpars.use_osmux) {
+                               if (not 
ispresent(bssap.pdu.bssmap.assignmentRequest.osmuxCID)) {
+                                       setverdict(fail, "MSC sent AssignReq 
without expected OsmuxCID IE");
+                                       mtc.stop;
+                               }
+                               osmuxCID := valueof(ts_OsmuxCID(0));
+                               if (cpars.use_osmux and not 
match(bssap.pdu.bssmap.assignmentRequest.osmuxCID, osmuxCID)) {
+                                       setverdict(fail, "MSC sent AssignReq 
without expected OsmuxCID IE");
+                                       mtc.stop;
+                               }
+                               bssap := 
valueof(ts_BSSMAP_AssignmentComplete(omit, tla, codec, osmuxCID));
+                       } else {
+                               bssap := 
valueof(ts_BSSMAP_AssignmentComplete(omit, tla, codec));
+                       }
+                       BSSAP.send(bssap);

                        
BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_CONNECT(cpars.transaction_id)));
                        }
@@ -736,8 +770,18 @@
                                                                { 
int2str(cpars.rtp_payload_type) },
                                                                { 
valueof(ts_SDP_rtpmap(cpars.rtp_payload_type,
                                                                                
        cpars.rtp_sdp_format)),
-                                                                 
valueof(ts_SDP_ptime(20)) }));
-                       MGCP.send(ts_MDCX_ACK(mgcp_cmd.line.trans_id, 
cpars.mgcp_connection_id_mss, sdp));
+                                                                               
        valueof(ts_SDP_ptime(20)) }));
+                       if (cpars.use_osmux) {
+                               osmux_cid := 
f_MgcpCmd_extract_osmux_cid(mgcp_cmd);
+                               if (osmux_cid != 0) { /* we expect MSC to use 
specific CID here */
+                                       setverdict(fail, "MSC using unexpected 
CID " & int2str(osmux_cid) & " != 0");
+                                       mtc.stop;
+                               }
+                               mgcp_resp := 
ts_MDCX_ACK_osmux(mgcp_cmd.line.trans_id, cpars.mgcp_connection_id_bss, 
osmux_cid, sdp);
+                       } else {
+                               mgcp_resp := 
ts_MDCX_ACK(mgcp_cmd.line.trans_id, cpars.mgcp_connection_id_mss, sdp);
+                       }
+                       MGCP.send(mgcp_resp);
                        }

                /* MDCX setting up the CN side remote RTP address received from 
MNCC CONNECT */
@@ -806,7 +850,10 @@

        var MNCC_PDU mncc;
        var MgcpCommand mgcp_cmd;
+       var template MgcpResponse mgcp_resp;
        var boolean respond_to_dlcx;
+       var PDU_BSSAP bssap;
+       var MgcpOsmuxCID osmux_cid;

        if (cpars.emergency) {
                f_establish_fully(EST_TYPE_EMERG_CALL);
@@ -846,6 +893,10 @@
                        cpars.mgcp_ep := mgcp_cmd.line.ep;
                }

+               if (cpars.use_osmux) {
+                       osmux_cid := f_MgcpCmd_extract_osmux_cid(mgcp_cmd);
+               }
+
                var SDP_Message sdp := valueof(ts_SDP(cpars.mgw_rtp_ip_bss, 
cpars.mgw_rtp_ip_bss,
                                                        
hex2str(cpars.mgcp_call_id), "42",
                                                        cpars.mgw_rtp_port_bss,
@@ -854,8 +905,17 @@
                                                                                
cpars.rtp_sdp_format)),
                                                          
valueof(ts_SDP_ptime(20)) }));

-               var template MgcpResponse mgcp_resp;
-               mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, 
cpars.mgcp_connection_id_bss, sdp);
+               if (cpars.use_osmux) {
+                       osmux_cid := f_MgcpCmd_extract_osmux_cid(mgcp_cmd);
+                       if (osmux_cid != -1) { /* we expect MSC to use wildcard 
here */
+                               setverdict(fail, "MSC using unexpected CID " & 
int2str(osmux_cid) & " != -1");
+                               mtc.stop;
+                       }
+                       osmux_cid := 0;
+                       mgcp_resp := ts_CRCX_ACK_osmux(mgcp_cmd.line.trans_id, 
cpars.mgcp_connection_id_bss, osmux_cid, sdp);
+               } else {
+                       mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, 
cpars.mgcp_connection_id_bss, sdp);
+               }
                f_mgcp_par_append(mgcp_resp.params, 
ts_MgcpParSpecEP(cpars.mgcp_ep));
                MGCP.send(mgcp_resp);
                }
@@ -870,14 +930,30 @@
                MNCC.send(ts_MNCC_ALERT_req(cpars.mncc_callref));
                }

-       //[g_pars.ran_is_geran] BSSAP.receive(tr_BSSMAP_AssignmentReq(omit, 
tla_ass)) {
-       [] BSSAP.receive(tr_BSSMAP_AssignmentReq(omit, tla_ass)) {
+       //[g_pars.ran_is_geran] BSSAP.receive(tr_BSSMAP_AssignmentReq(omit, 
tla_ass)) -> value bssap {
+       [] BSSAP.receive(tr_BSSMAP_AssignmentReq(omit, tla_ass)) -> value bssap 
{
                log("f_mo_call_establish 4: rx Assignment Request");
                var BSSMAP_IE_AoIP_TransportLayerAddress tla;
                var BSSMAP_IE_SpeechCodec codec;
+               var BSSMAP_IE_Osmo_OsmuxCID osmuxCID;
+
                tla := 
valueof(ts_BSSMAP_IE_AoIP_TLA4(f_inet_addr(cpars.bss_rtp_ip), 
cpars.bss_rtp_port));
                codec := valueof(ts_BSSMAP_IE_SpeechCodec({ts_CodecFR}));
-               BSSAP.send(ts_BSSMAP_AssignmentComplete(omit, tla, codec));
+               if (cpars.use_osmux) {
+                       if (not 
ispresent(bssap.pdu.bssmap.assignmentRequest.osmuxCID)) {
+                               setverdict(fail, "MSC sent AssignReq without 
expected OsmuxCID IE");
+                               mtc.stop;
+                       }
+                       osmuxCID := valueof(ts_OsmuxCID(0));
+                       if (cpars.use_osmux and not 
match(bssap.pdu.bssmap.assignmentRequest.osmuxCID, osmuxCID)) {
+                               setverdict(fail, "MSC sent AssignReq without 
expected OsmuxCID IE");
+                               mtc.stop;
+                       }
+                       bssap := valueof(ts_BSSMAP_AssignmentComplete(omit, 
tla, codec, osmuxCID));
+               } else {
+                       bssap := valueof(ts_BSSMAP_AssignmentComplete(omit, 
tla, codec));
+               }
+               BSSAP.send(bssap);
                }
        /*
        [!g_pars.ran_is_geran] BSSAP.receive(tr_RANAP_RabAssReq(rab_sml)) {
@@ -895,7 +971,18 @@
                                                        { 
valueof(ts_SDP_rtpmap(cpars.rtp_payload_type,
                                                                                
cpars.rtp_sdp_format)),
                                                          
valueof(ts_SDP_ptime(20)) }));
-               MGCP.send(ts_MDCX_ACK(mgcp_cmd.line.trans_id, 
cpars.mgcp_connection_id_mss, sdp));
+
+               if (cpars.use_osmux) {
+                       osmux_cid := f_MgcpCmd_extract_osmux_cid(mgcp_cmd);
+                       if (osmux_cid != 0) { /* we expect MSC to use specific 
CID here */
+                               setverdict(fail, "MSC using unexpected CID " & 
int2str(osmux_cid) & " != 0");
+                               mtc.stop;
+                       }
+                       mgcp_resp := ts_MDCX_ACK_osmux(mgcp_cmd.line.trans_id, 
cpars.mgcp_connection_id_bss, osmux_cid, sdp);
+               } else {
+                       mgcp_resp := ts_MDCX_ACK(mgcp_cmd.line.trans_id, 
cpars.mgcp_connection_id_mss, sdp);
+               }
+               MGCP.send(mgcp_resp);
                }

        /* Second MGCP CRCX (this time for MSS/CN side) */
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index b64b872..0d6083e 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -275,7 +275,7 @@
        }
 }

-function f_init(integer num_bsc := 1, boolean sgsap := false, boolean gsup := 
true) runs on MTC_CT {
+function f_init(integer num_bsc := 1, boolean sgsap := false, boolean gsup := 
true, boolean osmux := false) runs on MTC_CT {

        if (g_initialized == true) {
                return;
@@ -288,7 +288,9 @@

        for (var integer i := 0; i < num_bsc; i := i + 1) {
                if (isbound(mp_bssap_cfg[i])) {
-                       f_ran_adapter_init(g_bssap[i], mp_bssap_cfg[i], 
"MSC_Test_" & int2str(i), BSC_RanOps);
+                       var RanOps ranops := BSC_RanOps;
+                       ranops.use_osmux := osmux;
+                       f_ran_adapter_init(g_bssap[i], mp_bssap_cfg[i], 
"MSC_Test_" & int2str(i), ranops);
                        f_ran_adapter_start(g_bssap[i]);
                } else {
                        testcase.stop("missing BSSAP configuration");
@@ -334,7 +336,7 @@

 /* FIXME: move into BSC_ConnectionHandler? */
 function f_init_pars(integer imsi_suffix, boolean sgsap := false, boolean gsup 
:= true, integer ran_idx := 0,
-                    boolean ran_is_geran := true)
+                    boolean ran_is_geran := true, boolean use_osmux := false)
 runs on MTC_CT return BSC_ConnHdlrPars {
        var BSC_ConnHdlrNetworkPars net_pars := {
                kc_support := '0A'O,    /* A5/1 and A5/3 enabled */
@@ -364,7 +366,8 @@
                gsup_enable := gsup,
                ran_idx := ran_idx,
                use_umts_aka := false,
-               ran_is_geran := ran_is_geran
+               ran_is_geran := ran_is_geran,
+               use_osmux := use_osmux
        };
        if (not ran_is_geran) {
                pars.use_umts_aka := true;
@@ -407,9 +410,9 @@
        return vc_conn;
 }

-function f_start_handler(void_fn fn, integer imsi_suffix, integer ran_idx := 
0, boolean ran_is_geran := true)
+function f_start_handler(void_fn fn, integer imsi_suffix, integer ran_idx := 
0, boolean ran_is_geran := true, boolean use_osmux := false)
 runs on MTC_CT return BSC_ConnHdlr {
-       return f_start_handler_with_pars(fn, f_init_pars(imsi_suffix, ran_idx 
:= ran_idx, ran_is_geran := ran_is_geran));
+       return f_start_handler_with_pars(fn, f_init_pars(imsi_suffix, ran_idx 
:= ran_idx, ran_is_geran := ran_is_geran, use_osmux := use_osmux));
 }

 private function f_tc_lu_imsi_noauth_tmsi(charstring id, BSC_ConnHdlrPars 
pars) runs on BSC_ConnHdlr {
@@ -1711,6 +1714,7 @@
        cpars.bss_rtp_port := 1110;
        cpars.mgcp_connection_id_bss := '10004'H;
        cpars.mgcp_connection_id_mss := '10005'H;
+       cpars.use_osmux := pars.use_osmux;

        /* Note: This is an optional parameter. When the call-agent (MSC) does
         * supply a full endpoint name this setting will be overwritten. */
@@ -1727,6 +1731,15 @@
        vc_conn.done;
 }

+testcase TC_lu_and_mt_call_osmux() runs on MTC_CT {
+       var BSC_ConnHdlr vc_conn;
+       f_init(1, false, true, true);
+       f_vty_config(MSCVTY, "msc", "osmux on");
+
+       vc_conn := f_start_handler(refers(f_tc_lu_and_mt_call), 39, 0, true, 
true);
+       vc_conn.done;
+}
+
 /* Test MO Call SETUP with DTMF */
 private function f_tc_mo_setup_dtmf_dup(charstring id, BSC_ConnHdlrPars pars) 
runs on BSC_ConnHdlr {
        f_init_handler(pars);
@@ -5303,6 +5316,8 @@
        execute( TC_lu_imsi_auth_tmsi_encr_3_1_log_msc_debug() );
        execute( TC_gsup_mt_multi_part_sms() );
        execute( TC_mo_cc_bssmap_clear() );
+
+       execute( TC_lu_and_mt_call_osmux() );
 }



--
To view, visit https://gerrit.osmocom.org/14121
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibcb82d1a2d570c6c0ad0c3b6504bffe2244eccd9
Gerrit-Change-Number: 14121
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>

Reply via email to