diff options
| author | Daniel Willmann <dwillmann@sysmocom.de> | 2017-03-01 18:56:38 +0100 |
|---|---|---|
| committer | Daniel Willmann <dwillmann@sysmocom.de> | 2017-03-02 16:58:25 +0100 |
| commit | 8f655c184c373a143d548bd6f95a87a2e76a3246 (patch) | |
| tree | 7d7e417f973d75428ad15287a1684971d7b4068b | |
| parent | c9687b543da8cfa160607fb31a2103d1dd9eb6e3 (diff) | |
tests: Test IMSI routing with multiple MSCs
Change-Id: Iab46d45aa8ba708282debcd7b9d704fc40e6ff1f
Ticket: SYS#3208
Sponsored-by: On-Waves ehf.
| -rw-r--r-- | openbsc/tests/bsc-nat/bsc_nat_test.c | 49 | ||||
| -rw-r--r-- | openbsc/tests/bsc-nat/bsc_nat_test.ok | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c index a4b313c91..558d09382 100644 --- a/openbsc/tests/bsc-nat/bsc_nat_test.c +++ b/openbsc/tests/bsc-nat/bsc_nat_test.c @@ -1546,6 +1546,54 @@ static void test_nat_extract_lac() bsc_nat_free(nat); } +static void test_multiple_msc_fwd() +{ + int res; + struct bsc_nat *nat; + struct msc_config *msc; + struct bsc_msg_acc_lst *acc; + struct bsc_msg_acc_lst_entry *entry; + char *re1 = "^1[0-9]*$"; + char *re2 = "^2[0-9]*$"; + + printf("Test routing IMSIs to different MSCs\n"); + + /* Initialize the test case */ + nat = bsc_nat_alloc(); + + /* Create MSC configs */ + msc = msc_config_alloc(nat); + msc->msc_con = 0x23; + msc->acc_lst_name = "msc1"; + + msc = msc_config_alloc(nat); + msc->msc_con = 0x42; + msc->acc_lst_name = "msc2"; + + /* Create the ACLs */ + acc = bsc_msg_acc_lst_get(nat, &nat->access_lists, "msc1"); + OSMO_ASSERT(acc); + entry = bsc_msg_acc_lst_entry_create(acc); + OSMO_ASSERT(entry); + res = gsm_parse_reg(acc, &entry->imsi_allow_re, &entry->imsi_allow, 1, &re1); + OSMO_ASSERT(!res); + + acc = bsc_msg_acc_lst_get(nat, &nat->access_lists, "msc2"); + OSMO_ASSERT(acc); + entry = bsc_msg_acc_lst_entry_create(acc); + OSMO_ASSERT(entry); + res = gsm_parse_reg(acc, &entry->imsi_allow_re, &entry->imsi_allow, 1, &re2); + OSMO_ASSERT(!res); + + /* Check that IMSIs are routed to the correct MSCs */ + OSMO_ASSERT(msc_conn_by_imsi(nat, "100") == 0x23); + OSMO_ASSERT(msc_conn_by_imsi(nat, "101") == 0x23); + OSMO_ASSERT(msc_conn_by_imsi(nat, "200") == 0x42); + OSMO_ASSERT(msc_conn_by_imsi(nat, "201") == 0x42); + + bsc_nat_free(nat); +} + int main(int argc, char **argv) { sccp_set_log_area(DSCCP); @@ -1568,6 +1616,7 @@ int main(int argc, char **argv) test_mgcp_allocations(); test_barr_list_parsing(); test_nat_extract_lac(); + test_multiple_msc_fwd(); printf("Testing execution completed.\n"); return 0; diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.ok b/openbsc/tests/bsc-nat/bsc_nat_test.ok index ab04f4273..986a24452 100644 --- a/openbsc/tests/bsc-nat/bsc_nat_test.ok +++ b/openbsc/tests/bsc-nat/bsc_nat_test.ok @@ -36,4 +36,5 @@ IMSI: 12123127 CM: 3 LU: 5 IMSI: 12123128 CM: 3 LU: 6 IMSI: 12123124 CM: 3 LU: 2 Testing LAC extraction from SCCP CR +Test routing IMSIs to different MSCs Testing execution completed. |
