msc_vlr_test_call: assignment indicate FR or HR

Change-Id: I47c18a56a86005d6ae270bfd78bc13b2a7560192
This commit is contained in:
Neels Hofmeyr 2024-02-05 05:19:23 +01:00
parent 602961bc5d
commit 2b83b385cd
3 changed files with 49 additions and 13 deletions

View File

@ -272,7 +272,7 @@ static void test_call_mo()
btw("Assignment succeeds, triggering MNCC_RTP_CREATE ack to MNCC");
cc_to_mncc_expect_tx("", MNCC_RTP_CREATE);
ms_sends_assignment_complete("AMR");
ms_sends_assignment_complete(true, "AMR:octet-align=1");
OSMO_ASSERT(cc_to_mncc_tx_confirmed);
btw("MNCC says that's fine");
@ -408,7 +408,7 @@ static void test_call_mt()
btw("Assignment completes, triggering CRCX to CN");
expect_crcx(RTP_TO_CN);
ms_sends_assignment_complete("AMR");
ms_sends_assignment_complete(true, "AMR:octet-align=1");
btw("MNCC sends MNCC_RTP_CREATE, which first waits for the CN side RTP");
mncc_sends_to_cc(MNCC_RTP_CREATE, &mncc_rtp);
@ -548,7 +548,7 @@ static void test_call_mt2()
OSMO_ASSERT(iu_rab_assignment_sent);
btw("Assignment completes, triggering CRCX to CN");
ms_sends_assignment_complete("AMR");
ms_sends_assignment_complete(true, "AMR:octet-align=1");
btw("When the CN side RTP address is known, ack MNCC_RTP_CREATE with full SDP");
cc_to_mncc_expect_tx("", MNCC_RTP_CREATE);
@ -653,7 +653,7 @@ static void test_call_mo_to_unknown()
btw("Assignment succeeds, triggering MNCC_RTP_CREATE ack to MNCC");
cc_to_mncc_expect_tx("", MNCC_RTP_CREATE);
ms_sends_assignment_complete("AMR");
ms_sends_assignment_complete(true, "AMR:octet-align=1");
OSMO_ASSERT(cc_to_mncc_tx_confirmed);
btw("MNCC says that's fine");
@ -750,7 +750,7 @@ static void test_call_mo_to_unknown_timeout()
btw("Assignment succeeds, triggering MNCC_RTP_CREATE ack to MNCC");
cc_to_mncc_expect_tx("", MNCC_RTP_CREATE);
ms_sends_assignment_complete("AMR");
ms_sends_assignment_complete(true, "AMR:octet-align=1");
OSMO_ASSERT(cc_to_mncc_tx_confirmed);
btw("MNCC says that's fine");
@ -802,6 +802,7 @@ struct codec_test {
enum gsm0808_permitted_speech mo_tx_assignment_perm_speech[8];
/* What codec to assign in the Assignment Complete's Codec (Chosen) IE. Just a subtype name. */
bool mo_rx_assigned_codec_fr;
const char *mo_rx_assigned_codec;
/* MO acks the MNCC_RTP_CREATE with these codecs (if any). */
@ -819,6 +820,7 @@ struct codec_test {
const char *mt_tx_sdp_mncc_call_conf_ind[16];
enum gsm0808_permitted_speech mt_tx_assignment_perm_speech[8];
bool mt_rx_assigned_codec_fr;
const char *mt_rx_assigned_codec;
const char *mt_rx_sdp_mncc_rtp_create[16];
@ -829,6 +831,7 @@ struct codec_test {
bool mo_expect_reassignment;
enum gsm0808_permitted_speech mo_tx_reassignment_perm_speech[8];
bool mo_rx_reassigned_codec_fr;
const char *mo_rx_reassigned_codec;
const char *mt_tx_sdp_mncc_setup_cnf[16];
@ -905,6 +908,7 @@ static const struct codec_test codec_tests[] = {
.mo_tx_sdp_mncc_setup_ind = SDP_CODECS_ALL_GSM,
.mo_rx_sdp_mncc_rtp_create = {},
.mo_tx_assignment_perm_speech = PERM_SPEECH_ALL_GSM,
.mo_rx_assigned_codec_fr = true,
.mo_rx_assigned_codec = "AMR",
.mo_tx_sdp_mncc_rtp_create = SDP_CODECS_ALL_GSM,
/* mt_rx_sdp_mncc_setup_req == mo_tx_sdp_mncc_rtp_create */
@ -928,6 +932,7 @@ static const struct codec_test codec_tests[] = {
GSM0808_PERM_HR1,
LIST_END
},
.mt_rx_assigned_codec_fr = true,
.mt_rx_assigned_codec = "AMR",
.mt_tx_sdp_mncc_rtp_create = SDP_CODECS_ALL_GSM,
.mt_tx_sdp_mncc_alert_ind = SDP_CODECS_ALL_GSM,
@ -942,6 +947,7 @@ static const struct codec_test codec_tests[] = {
.mo_tx_sdp_mncc_setup_ind = { "GSM#3" },
.mo_rx_sdp_mncc_rtp_create = {},
.mo_tx_assignment_perm_speech = { GSM0808_PERM_FR1, LIST_END },
.mo_rx_assigned_codec_fr = true,
.mo_rx_assigned_codec = "GSM",
.mo_tx_sdp_mncc_rtp_create = { "GSM#3" },
/* mt_rx_sdp_mncc_setup_req == mo_tx_sdp_mncc_rtp_create */
@ -951,6 +957,7 @@ static const struct codec_test codec_tests[] = {
.mt_tx_sdp_mncc_call_conf_ind = {},
.mt_rx_sdp_mncc_rtp_create = {},
.mt_tx_assignment_perm_speech = { GSM0808_PERM_FR1, LIST_END },
.mt_rx_assigned_codec_fr = true,
.mt_rx_assigned_codec = "GSM",
.mt_tx_sdp_mncc_rtp_create = { "GSM#3" },
.mt_tx_sdp_mncc_alert_ind = { "GSM#3" },
@ -965,6 +972,7 @@ static const struct codec_test codec_tests[] = {
.mo_tx_sdp_mncc_setup_ind = { "GSM#3" },
.mo_rx_sdp_mncc_rtp_create = {},
.mo_tx_assignment_perm_speech = { GSM0808_PERM_FR1, LIST_END },
.mo_rx_assigned_codec_fr = true,
.mo_rx_assigned_codec = "GSM",
.mo_tx_sdp_mncc_rtp_create = { "GSM#3" },
/* mt_rx_sdp_mncc_setup_req == mo_tx_sdp_mncc_rtp_create */
@ -974,6 +982,7 @@ static const struct codec_test codec_tests[] = {
.mt_tx_sdp_mncc_call_conf_ind = {},
.mt_rx_sdp_mncc_rtp_create = {},
.mt_tx_assignment_perm_speech = { GSM0808_PERM_FR1, LIST_END },
.mt_rx_assigned_codec_fr = true,
.mt_rx_assigned_codec = "GSM",
.mt_tx_sdp_mncc_rtp_create = { "GSM#3" },
.mt_tx_sdp_mncc_alert_ind = { "GSM#3" },
@ -988,6 +997,7 @@ static const struct codec_test codec_tests[] = {
.mo_tx_sdp_mncc_setup_ind = SDP_CODECS_ALL_GSM,
.mo_rx_sdp_mncc_rtp_create = {},
.mo_tx_assignment_perm_speech = PERM_SPEECH_ALL_GSM,
.mo_rx_assigned_codec_fr = true,
.mo_rx_assigned_codec = "AMR", /* <- Early Assignment first picks a mismatching codec */
.mo_tx_sdp_mncc_rtp_create = SDP_CODECS_ALL_GSM,
@ -1007,6 +1017,7 @@ static const struct codec_test codec_tests[] = {
GSM0808_PERM_FR1,
LIST_END
},
.mt_rx_assigned_codec_fr = true,
.mt_rx_assigned_codec = "GSM",
.mt_tx_sdp_mncc_rtp_create = { "GSM#3" },
.mt_tx_sdp_mncc_alert_ind = { "GSM#3" },
@ -1016,6 +1027,7 @@ static const struct codec_test codec_tests[] = {
GSM0808_PERM_FR1,
LIST_END
},
.mo_rx_reassigned_codec_fr = true,
.mo_rx_reassigned_codec = "GSM",
.mt_tx_sdp_mncc_setup_cnf = { "GSM#3" },
@ -1029,6 +1041,7 @@ static const struct codec_test codec_tests[] = {
.mo_tx_sdp_mncc_setup_ind = SDP_CODECS_ALL_GSM,
.mo_rx_sdp_mncc_rtp_create = {},
.mo_tx_assignment_perm_speech = PERM_SPEECH_ALL_GSM,
.mo_rx_assigned_codec_fr = true,
.mo_rx_assigned_codec = "AMR", /* <- Early Assignment first picks a mismatching codec */
.mo_tx_sdp_mncc_rtp_create = SDP_CODECS_ALL_GSM,
@ -1046,6 +1059,7 @@ static const struct codec_test codec_tests[] = {
GSM0808_PERM_FR1,
LIST_END
},
.mt_rx_assigned_codec_fr = true,
.mt_rx_assigned_codec = "GSM",
.mt_tx_sdp_mncc_rtp_create = { "GSM#3" },
.mt_tx_sdp_mncc_alert_ind = { "GSM#3" },
@ -1055,6 +1069,7 @@ static const struct codec_test codec_tests[] = {
GSM0808_PERM_FR1,
LIST_END
},
.mo_rx_reassigned_codec_fr = true,
.mo_rx_reassigned_codec = "GSM",
.mt_tx_sdp_mncc_setup_cnf = { "GSM#3" },
@ -1068,6 +1083,7 @@ static const struct codec_test codec_tests[] = {
.mo_tx_sdp_mncc_setup_ind = SDP_CODECS_ALL_GSM,
.mo_rx_sdp_mncc_rtp_create = {},
.mo_tx_assignment_perm_speech = PERM_SPEECH_ALL_GSM,
.mo_rx_assigned_codec_fr = true,
.mo_rx_assigned_codec = "AMR",
.mo_tx_sdp_mncc_rtp_create = SDP_CODECS_ALL_GSM,
/* mt_rx_sdp_mncc_setup_req == mo_tx_sdp_mncc_rtp_create */
@ -1091,6 +1107,7 @@ static const struct codec_test codec_tests[] = {
GSM0808_PERM_HR1,
LIST_END
},
.mt_rx_assigned_codec_fr = true,
.mt_rx_assigned_codec = "AMR",
/* We want to test how osmo-msc reacts to a peer using different payload type nrs. So below SDP string
@ -1117,6 +1134,7 @@ static const struct codec_test codec_tests[] = {
.mo_tx_sdp_mncc_setup_ind = SDP_CODECS_ALL_GSM,
.mo_rx_sdp_mncc_rtp_create = {},
.mo_tx_assignment_perm_speech = PERM_SPEECH_ALL_GSM,
.mo_rx_assigned_codec_fr = true,
.mo_rx_assigned_codec = "AMR",
/* We want to test how osmo-msc reacts to a peer using different payload type nrs. So below SDP string
* features odd numbers that osmo-msc would never pick.
@ -1150,6 +1168,7 @@ static const struct codec_test codec_tests[] = {
GSM0808_PERM_HR1,
LIST_END
},
.mt_rx_assigned_codec_fr = true,
.mt_rx_assigned_codec = "AMR",
.mt_tx_sdp_mncc_rtp_create = SDP_CODECS_ALL_GSM_WITH_ODD_PT_NRS,
.mt_tx_sdp_mncc_alert_ind = SDP_CODECS_ALL_GSM_WITH_ODD_PT_NRS,
@ -1422,10 +1441,11 @@ static void test_codecs_mo(const struct codec_test *t)
OSMO_ASSERT(bssap_assignment_sent);
VALIDATE_PERM_SPEECH(&bssap_assignment_command_last_channel_type, t->mo_tx_assignment_perm_speech);
btw("Assignment succeeds with %s, triggering MNCC_RTP_CREATE ack to MNCC with %s", t->mo_rx_assigned_codec,
btw("Assignment succeeds with %s %s, triggering MNCC_RTP_CREATE ack to MNCC with %s",
t->mo_rx_assigned_codec_fr ? "FR" : "HR", t->mo_rx_assigned_codec,
strlist_name(t->mo_tx_sdp_mncc_rtp_create));
cc_to_mncc_expect_tx("", MNCC_RTP_CREATE);
ms_sends_assignment_complete(t->mo_rx_assigned_codec);
ms_sends_assignment_complete(t->mo_rx_assigned_codec_fr, t->mo_rx_assigned_codec);
OSMO_ASSERT(cc_to_mncc_tx_confirmed);
VALIDATE_SDP(cc_to_mncc_tx_last_sdp, t->mo_tx_sdp_mncc_rtp_create,
!t->mo_tx__ignore_pt_nrs);
@ -1454,7 +1474,7 @@ static void test_codecs_mo(const struct codec_test *t)
btw("Validating re-assignment");
OSMO_ASSERT(bssap_assignment_sent);
VALIDATE_PERM_SPEECH(&bssap_assignment_command_last_channel_type, t->mo_tx_reassignment_perm_speech);
ms_sends_assignment_complete(t->mo_rx_reassigned_codec);
ms_sends_assignment_complete(t->mo_rx_reassigned_codec_fr, t->mo_rx_reassigned_codec);
}
dtap_expect_tx("8307" /* CC: Connect */);
@ -1591,7 +1611,7 @@ static void test_codecs_mt(const struct codec_test *t)
VALIDATE_PERM_SPEECH(&bssap_assignment_command_last_channel_type, t->mt_tx_assignment_perm_speech);
btw("Assignment completes, triggering CRCX to CN");
ms_sends_assignment_complete(t->mt_rx_assigned_codec);
ms_sends_assignment_complete(t->mt_rx_assigned_codec_fr, t->mt_rx_assigned_codec);
btw("MNCC sends MNCC_RTP_CREATE, which first waits for the CN side RTP");
sdp_str_from_codec_strs(mncc_rtp.sdp, sizeof(mncc_rtp.sdp), t->mt_rx_sdp_mncc_rtp_create);

View File

@ -1059,7 +1059,7 @@ void ms_sends_security_mode_complete(uint8_t utran_encryption)
g_msub = NULL;
}
void ms_sends_assignment_complete(const char *sdp_codec_str)
void ms_sends_assignment_complete(bool fr, const char *sdp_codec_str)
{
const struct codec_mapping *m;
struct sdp_audio_codec codec;
@ -1069,11 +1069,27 @@ void ms_sends_assignment_complete(const char *sdp_codec_str)
codec_mapping_foreach (m) {
if (!m->has_gsm0808_speech_codec)
continue;
if (!sdp_audio_codec_cmp(&m->sdp, &codec, true, false))
break;
if (fr) {
if (m->frhr != CODEC_FRHR_FR)
continue;
} else {
if (m->frhr != CODEC_FRHR_HR)
continue;
}
if (sdp_audio_codec_cmp(&m->sdp, &codec, true, false))
continue;
break;
}
if (!m)
btw("ERROR: no codec_mapping for %s", sdp_codec_str);
OSMO_ASSERT(m);
btw("ms_sends_assignment_complete(%s) -> %s 0x%x", sdp_codec_str,
gsm0808_speech_codec_type_name(m->gsm0808_speech_codec.type),
m->gsm0808_speech_codec.cfg);
ran_dec = (struct ran_msg){
.msg_type = RAN_MSG_ASSIGNMENT_COMPLETE,
.assignment_complete = {

View File

@ -192,7 +192,7 @@ void ms_sends_compl_l3(const char *hex, const struct gsm0808_speech_codec_list *
void ms_sends_classmark_update(const struct osmo_gsm48_classmark *classmark);
void ms_sends_ciphering_mode_complete(const char *inner_nas_msg);
void ms_sends_security_mode_complete(uint8_t utran_encryption);
void ms_sends_assignment_complete(const char *sdp_codec_name);
void ms_sends_assignment_complete(bool fr, const char *sdp_codec_str);
void gsup_rx(const char *rx_hex, const char *expect_tx_hex);
void send_sms(struct vlr_subscr *receiver,
struct vlr_subscr *sender,