neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35053?usp=email )


Change subject: msc: test re-assignment to match codec with MT
......................................................................

msc: test re-assignment to match codec with MT

Related: osmo-msc I8760feaa8598047369ef8c3ab2673013bac8ac8a
Change-Id: I402ed0523a2a87b83f29c5577b2c828102005d53
---
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
2 files changed, 87 insertions(+), 2 deletions(-)



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

diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 1737071..d31f124 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -982,6 +982,18 @@
        CrcxResponse mgw_conn_2,
        uint7_t rtp_payload_type,                       /* dynamic RTP payload 
type */
        charstring rtp_sdp_format,                      /* AMR/8000 or the like 
*/
+
+       /* What to Codec (Chosen) to send back in Assignment Complete */
+       BSSMAP_FIELD_CodecElement ass_compl_chosen_codec,
+       /* MNCC_ALERT_REQ is when MO learns MT's codec capabilities */
+       charstring mncc_alert_req_sends_remote_sdp,
+       /* Set to true when mncc_alert_req_sends_remote_sdp should trigger a 
2nd Assignment to adjust the codec */
+       boolean expect_re_assignment,
+       /* If expect_re_assignment: verify codecs seen in 2nd Assignment 
Request */
+       BSSMAP_FIELD_CodecElements re_ass_req_codecs,
+       /* If expect_re_assignment: What Codec (Chosen) to send back in 2nd 
Assignment Complete */
+       BSSMAP_FIELD_CodecElement re_ass_compl_chosen_codec,
+
        boolean mgw_drop_dlcx optional,                 /* Provoke errors by 
not responding to DLCX
                                                           (f_mt_call and 
f_mt_call) */
        boolean stop_after_cc_setup,                    /* Special case: stop 
call establish after CC Setup */
@@ -1025,6 +1037,11 @@
        },
        rtp_payload_type := 98,
        rtp_sdp_format := "AMR/8000",
+       ass_compl_chosen_codec := ts_CodecFR,
+       mncc_alert_req_sends_remote_sdp := "",
+       expect_re_assignment := false,
+       re_ass_req_codecs := {ts_CodecFR},
+       re_ass_compl_chosen_codec := ts_CodecFR,
        mgw_drop_dlcx := false,
        stop_after_cc_setup := false,
        ran_clear_when_alerting := false,
@@ -1055,6 +1072,11 @@
        mgw_conn_2 := ?,
        rtp_payload_type := ?,
        rtp_sdp_format := ?,
+       ass_compl_chosen_codec := ?,
+       mncc_alert_req_sends_remote_sdp := ?,
+       expect_re_assignment := ?,
+       re_ass_req_codecs := ?,
+       re_ass_compl_chosen_codec := ?,
        mgw_drop_dlcx := ?,
        stop_after_cc_setup := ?,
        ran_clear_when_alerting := ?,
@@ -1681,13 +1703,31 @@
                
BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(cpars.transaction_id)));

                /* Alerting */
-               MNCC.send(ts_MNCC_ALERT_req(cpars.mncc_callref));
+               var MNCC_PDU mncc_alert_req := 
valueof(ts_MNCC_ALERT_req(cpars.mncc_callref));
+
+               /* Tell the MO call leg about MT's codecs, via SDP in MNCC */
+               mncc_alert_req.u.signal.sdp := 
cpars.mncc_alert_req_sends_remote_sdp;
+
+               MNCC.send(mncc_alert_req);
+
+               if (cpars.expect_re_assignment) {
+                       /* Another Assignment Request is expected after telling 
the MO call leg about MT's codecs */
+                       BSSAP.receive(tr_BSSMAP_AssignmentReq(omit)) -> value 
bssap;
+
+                       if (not 
match(bssap.pdu.bssmap.assignmentRequest.codecList.codecElements,
+                                     cpars.re_ass_req_codecs)) {
+                               setverdict(fail, "MSC sent Assignment Request 
with unexpected codec list");
+                               mtc.stop;
+                       }
+
+                       f_mo_call_establish__handle_assignment_request(cpars, 
bssap, cpars.re_ass_compl_chosen_codec);
+               }
                }

        //[g_pars.ran_is_geran] BSSAP.receive(tr_BSSMAP_AssignmentReq(omit, 
tla_ass)) -> value bssap
        [] BSSAP.receive(tr_BSSMAP_AssignmentReq(omit)) -> value bssap {
                log("f_mo_call_establish 4: rx Assignment Request");
-               f_mo_call_establish__handle_assignment_request(cpars, bssap, 
cpars.ass_compl_chosen_codec);
+               f_mo_call_establish__handle_assignment_request(cpars, bssap, 
valueof(ts_CodecFR));
                }
        [] BSSAP.receive(tr_RANAP_RabAssReq(*)) -> value ranap {
                log("f_mo_call_establish 4.iu: rx RANAP RAB Assignment 
Request");
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 6f23e5f..7ec94c5 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -7304,6 +7304,39 @@
        vc_conn.done;
 }

+friend function f_tc_lu_and_mo_call_reass_for_mt_codec(charstring id, 
BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
+       f_init_handler(pars);
+       var CallParameters cpars := valueof(t_CallParams);
+       /* MO will first choose GSM-FR = BSC returns GSM-FR in Assignment 
Complete's Codec (Chosen) */
+       cpars.ass_compl_chosen_codec := valueof(ts_CodecFR);
+       /* But when the MT call leg responds, we learn that it only supports 
AMR */
+       cpars.mncc_alert_req_sends_remote_sdp :=
+                         "v=0\r\n"
+                       & "o=BSC_ConnectionHandler.ttcn 0 0 IN IP4 1.1.1.1\r\n"
+                       & "s=GSM Call\r\n"
+                       & "c=IN IP4 " & cpars.bss_rtp_ip & "\r\n"
+                       & "t=0 0\r\n"
+                       & "m=audio " & int2str(cpars.bss_rtp_port) & " RTP/AVP 
112\r\n"
+                       & "a=rtpmap:112 AMR/8000\r\n"
+                       & "a=fmtp:112 octet-align=1\r\n"
+                       & "a=ptime:20\r\n";
+       /* MSC should ask for another Assignment after MNCC_ALERT_REQ, that 
should now contain only the remote call
+        * leg's capabilities, i.e. only AMR. */
+       cpars.expect_re_assignment := true;
+       cpars.re_ass_req_codecs := {valueof(ts_CodecAMR_F), 
valueof(ts_CodecAMR_H)};
+       /* When the MSC asks for another Assignment after MNCC_ALERT_REQ, we'll 
give it AMR. */
+       cpars.re_ass_compl_chosen_codec := valueof(ts_CodecAMR_F);
+       f_perform_lu();
+       f_mo_call(cpars);
+}
+testcase TC_lu_and_mo_call_reass_for_mt_codec() runs on MTC_CT {
+       var BSC_ConnHdlr vc_conn;
+       f_init();
+
+       vc_conn := 
f_start_handler(refers(f_tc_lu_and_mo_call_reass_for_mt_codec), 7);
+       vc_conn.done;
+}
+
 control {
        execute( TC_cr_before_reset() );
        execute( TC_lu_imsi_noauth_tmsi() );
@@ -7486,6 +7519,8 @@

        execute( TC_lu_and_mo_csd() );
        execute( TC_lu_and_mt_csd() );
+
+       execute( TC_lu_and_mo_call_reass_for_mt_codec() );
 }



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35053?usp=email
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: I402ed0523a2a87b83f29c5577b2c828102005d53
Gerrit-Change-Number: 35053
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>
Gerrit-MessageType: newchange

Reply via email to