aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tbf/TbfTest.cpp
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-10-26 12:40:11 +0100
committerpespin <pespin@sysmocom.de>2020-10-29 11:34:17 +0000
commit528820dbe13d47de6f92e22993b6704f5e61b2e4 (patch)
tree4a960100976939367b505b0fb95b4bbde98f7f64 /tests/tbf/TbfTest.cpp
parent87c6dd3c265df114357dda6c3e601f4754689b9f (diff)
tbf: Clean up gprs_rlcmac_dl_tbf::handle()
Avoid passing tons of params to internal helper function tbf_nel_dl_assignment() in order to either fetch again the ms object or create a new one. Let's instead create the ms function earlier if needed and fill it with all the discovered information prior to calling the helper function. This provides cleaner code and also better log output. This way we also avoid trying to fill the MS twice and unneeded getter+setter for TA. tbf::imsi(): There' always an ms, so simply forward call to ms()->imsi(). We can also get rid of assign_imsi, since the modified code is the only place where it's used and there's already some code in place there to update the MS. We instead merge it with set_imsi and keep the duplication code to catch possible bugs from callers. Move merge_and_clear_ms from tbf class to GprsMS, where it really belongs. Change-Id: Id18098bac3cff26fc4a8d2f419e21641a1f4c83b
Diffstat (limited to 'tests/tbf/TbfTest.cpp')
-rw-r--r--tests/tbf/TbfTest.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 2b5bda51..d1fdfba7 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -420,7 +420,7 @@ static void test_tbf_imsi()
dl_tbf[0]->update_ms(0xf1000001, GPRS_RLCMAC_DL_TBF);
dl_tbf[1]->update_ms(0xf1000002, GPRS_RLCMAC_DL_TBF);
- dl_tbf[0]->assign_imsi("001001000000001");
+ dl_tbf[0]->ms()->set_imsi("001001000000001");
ms1 = the_bts.ms_store().get_ms(0, 0, "001001000000001");
OSMO_ASSERT(ms1 != NULL);
ms2 = the_bts.ms_store().get_ms(0xf1000001);
@@ -429,7 +429,7 @@ static void test_tbf_imsi()
OSMO_ASSERT(ms1 == ms2);
/* change the IMSI on TBF 0 */
- dl_tbf[0]->assign_imsi("001001000000002");
+ dl_tbf[0]->ms()->set_imsi("001001000000002");
ms1 = the_bts.ms_store().get_ms(0, 0, "001001000000001");
OSMO_ASSERT(ms1 == NULL);
ms1 = the_bts.ms_store().get_ms(0, 0, "001001000000002");
@@ -437,10 +437,10 @@ static void test_tbf_imsi()
OSMO_ASSERT(strcmp(ms2->imsi(), "001001000000002") == 0);
OSMO_ASSERT(ms1 == ms2);
- /* use the same IMSI on TBF 2 */
+ /* use the same IMSI on TBF 1 */
{
GprsMs::Guard guard(ms2);
- dl_tbf[1]->assign_imsi("001001000000002");
+ dl_tbf[1]->ms()->set_imsi("001001000000002");
ms1 = the_bts.ms_store().get_ms(0, 0, "001001000000002");
OSMO_ASSERT(ms1 != NULL);
OSMO_ASSERT(ms1 != ms2);