diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-04-16 13:23:43 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-04-16 14:14:17 +0200 |
commit | b2b291d3efea54a60c2e5c50f8ac34a2f12125cd (patch) | |
tree | 13a9793755108f044ebaf31d6e914986eb06ecf7 /openbsc/tests | |
parent | c279e39c128615286a50e440179b6957158ceadb (diff) |
nat: Extract the LAC/CI from the Complete Layer3 Information
Find the Cell Identifier from the Complete Layer3 Information and
store it for future reference. We could begin to verify that the
LAC/CI used really belongs to the BSC.
Diffstat (limited to 'openbsc/tests')
-rw-r--r-- | openbsc/tests/bsc-nat/bsc_nat_test.c | 35 | ||||
-rw-r--r-- | openbsc/tests/bsc-nat/bsc_nat_test.ok | 1 |
2 files changed, 36 insertions, 0 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c index 18668bb4b..cbc1f1821 100644 --- a/openbsc/tests/bsc-nat/bsc_nat_test.c +++ b/openbsc/tests/bsc-nat/bsc_nat_test.c @@ -28,6 +28,7 @@ #include <openbsc/bsc_nat_sccp.h> #include <osmocom/core/application.h> +#include <osmocom/core/backtrace.h> #include <osmocom/core/talloc.h> #include <osmocom/sccp/sccp.h> @@ -1276,6 +1277,39 @@ static void test_barr_list_parsing(void) } } +static void test_nat_extract_lac() +{ + int res; + struct bsc_connection *bsc; + struct bsc_nat *nat; + struct nat_sccp_connection con; + struct bsc_nat_parsed *parsed; + struct msgb *msg = msgb_alloc(4096, "test-message"); + + printf("Testing LAC extraction from SCCP CR\n"); + + /* initialize the testcase */ + nat = bsc_nat_alloc(); + bsc = bsc_connection_alloc(nat); + bsc->cfg = bsc_config_alloc(nat, "foo"); + + memset(&con, 0, sizeof(con)); + con.bsc = bsc; + + /* create the SCCP CR */ + msg->l2h = msgb_put(msg, ARRAY_SIZE(bssmap_cr)); + memcpy(msg->l2h, bssmap_cr, ARRAY_SIZE(bssmap_cr)); + + /* parse it and pass it on */ + parsed = bsc_nat_parse(msg); + res = bsc_nat_extract_lac(bsc, &con, parsed, msg); + OSMO_ASSERT(res == 0); + + /* verify the LAC */ + OSMO_ASSERT(con.lac == 8210); + OSMO_ASSERT(con.ci == 50000); +} + int main(int argc, char **argv) { sccp_set_log_area(DSCCP); @@ -1295,6 +1329,7 @@ int main(int argc, char **argv) test_sms_number_rewrite(); test_mgcp_allocations(); test_barr_list_parsing(); + test_nat_extract_lac(); 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 cbedc85af..ab04f4273 100644 --- a/openbsc/tests/bsc-nat/bsc_nat_test.ok +++ b/openbsc/tests/bsc-nat/bsc_nat_test.ok @@ -35,4 +35,5 @@ IMSI: 12123126 CM: 3 LU: 4 IMSI: 12123127 CM: 3 LU: 5 IMSI: 12123128 CM: 3 LU: 6 IMSI: 12123124 CM: 3 LU: 2 +Testing LAC extraction from SCCP CR Testing execution completed. |