aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-05-02 16:20:32 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-05-02 19:19:15 +0200
commit1ffe98c17570cc38aff15ef6b4dbade89fd1a7e4 (patch)
tree70adcb379404ac4484f0d8fbc3e8f2e0100436c4 /openbsc/tests
parent66e14cdda6c3ef57d0d9e1964cd9f3b81a764bc4 (diff)
nat: Rewrite the paging handling.
The current code tries to find _one_ bsc for a paging message and then continues. The new code will try to find multiple BSCs for each LAC. This is done in preparation of having two BSCs handle the same LAC. This code right now is O(m*n) but it will be worse once paging groups are landed. The code to test the function was reduced to just test the lac lookup code as the other part can not be tested in a standalone setup anymore.
Diffstat (limited to 'openbsc/tests')
-rw-r--r--openbsc/tests/bsc-nat/bsc_nat_test.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index 50da1e904..8c0abc262 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -384,12 +384,9 @@ static void test_contrack()
static void test_paging(void)
{
- int lac;
struct bsc_nat *nat;
struct bsc_connection *con;
- struct bsc_nat_parsed *parsed;
struct bsc_config *cfg;
- struct msgb *msg;
fprintf(stderr, "Testing paging by lac.\n");
@@ -400,34 +397,20 @@ static void test_paging(void)
bsc_config_add_lac(cfg, 23);
con->authenticated = 1;
llist_add(&con->list_entry, &nat->bsc_connections);
- msg = msgb_alloc(4096, "test");
-
- /* Test completely bad input */
- copy_to_msg(msg, paging_by_lac_cmd, sizeof(paging_by_lac_cmd));
- if (bsc_nat_find_bsc(nat, msg, &lac) != 0) {
- fprintf(stderr, "Should have not found anything.\n");
- abort();
- }
/* Test it by not finding it */
- copy_to_msg(msg, paging_by_lac_cmd, sizeof(paging_by_lac_cmd));
- parsed = bsc_nat_parse(msg);
- if (bsc_nat_find_bsc(nat, msg, &lac) != 0) {
- fprintf(stderr, "Should have not found aynthing.\n");
+ if (bsc_config_handles_lac(cfg, 8213) != 0) {
+ fprintf(stderr, "Should not be handled.\n");
abort();
}
- talloc_free(parsed);
/* Test by finding it */
bsc_config_del_lac(cfg, 23);
bsc_config_add_lac(cfg, 8213);
- copy_to_msg(msg, paging_by_lac_cmd, sizeof(paging_by_lac_cmd));
- parsed = bsc_nat_parse(msg);
- if (bsc_nat_find_bsc(nat, msg, &lac) != con) {
+ if (bsc_config_handles_lac(cfg, 8213) == 0) {
fprintf(stderr, "Should have found it.\n");
abort();
}
- talloc_free(parsed);
}
static void test_mgcp_allocations(void)