neels has submitted this change. ( 
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
Depends: osmo-msc I0f1e1a551aed545b555b9f236fc5967b1e4cc940
Change-Id: I402ed0523a2a87b83f29c5577b2c828102005d53
---
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
2 files changed, 84 insertions(+), 7 deletions(-)

Approvals:
  neels: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 109888a..16309ed 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -979,7 +979,11 @@
        BearerCapability_TLV bearer_cap,                /* which bearer 
capabilities to claim */
        boolean emergency,                              /* is this an emergency 
call? */
        boolean csd,                                    /* is this a circuit 
switched data call? */
-       BSSMAP_FIELD_CodecElement tch_codec_chosen,     /* If TCH, which codec 
to send in BSSMAP Assignment Complete. */
+       BSSMAP_FIELD_CodecElement ass_compl_chosen_codec, /* If TCH, which 
codec to send in BSSMAP Assignment Complete. */
+       charstring mncc_alert_req_sends_remote_sdp,     /* SDP string. 
MNCC_ALERT_REQ is when MO learns MT's codec capabilities */
+       boolean expect_re_assignment,                   /* Set to true when 
mncc_alert_req_sends_remote_sdp should trigger a 2nd Assignment to adjust the 
codec */
+       BSSMAP_FIELD_CodecElements re_ass_req_codecs,   /* If 
expect_re_assignment: verify codecs seen in 2nd Assignment Request */
+       BSSMAP_FIELD_CodecElement re_ass_compl_chosen_codec, /* If 
expect_re_assignment: What Codec (Chosen) to send back in 2nd Assignment 
Complete */

        /* MNCC related parameters */
        uint32_t mncc_callref optional,                 /* call reference on 
the MNCC side */
@@ -1017,7 +1021,11 @@
        bearer_cap := valueof(ts_Bcap_voice),
        emergency := false,
        csd := false,
-       tch_codec_chosen := valueof(ts_CodecFR),
+       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,
        mncc_callref := omit,
        mncc_bearer_cap := valueof(ts_MNCC_bcap_voice),
        mncc_rtp_ip := "42.23.11.5",
@@ -1058,7 +1066,11 @@
        bearer_cap := ?,
        emergency := ?,
        csd := ?,
-       tch_codec_chosen := ?,
+       ass_compl_chosen_codec := ?,
+       mncc_alert_req_sends_remote_sdp := ?,
+       expect_re_assignment := ?,
+       re_ass_req_codecs := ?,
+       re_ass_compl_chosen_codec := ?,
        mncc_callref := *,
        mncc_bearer_cap := ?,
        mncc_rtp_ip := ?,
@@ -1609,7 +1621,8 @@
        }
 }

-private function f_mo_call_establish__handle_assignment_request(inout 
CallParameters cpars, PDU_BSSAP ass_req)
+private function f_mo_call_establish__handle_assignment_request(inout 
CallParameters cpars, PDU_BSSAP ass_req,
+                                                               
BSSMAP_FIELD_CodecElement tch_codec_chosen)
 runs on BSC_ConnHdlr {
        var BSSMAP_IE_AoIP_TransportLayerAddress tla;
        var BSSMAP_IE_SpeechCodec codec;
@@ -1645,7 +1658,7 @@
        if (cpars.csd) {
                codec := valueof(ts_BSSMAP_IE_SpeechCodec({ts_CodecCSData}));
        } else {
-               codec := 
valueof(ts_BSSMAP_IE_SpeechCodec({cpars.tch_codec_chosen}));
+               codec := valueof(ts_BSSMAP_IE_SpeechCodec({tch_codec_chosen}));
        }

        var PDU_BSSAP bssap;
@@ -1736,13 +1749,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);
+               f_mo_call_establish__handle_assignment_request(cpars, bssap, 
cpars.ass_compl_chosen_codec);
                }
        [] 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 898aeef..a503d20 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -7414,6 +7414,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() );
@@ -7602,6 +7635,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: 5
Gerrit-Owner: neels <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to