aboutsummaryrefslogtreecommitdiffstats
path: root/tests/abis
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-03-05 02:09:40 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2018-03-07 15:34:48 +0000
commitf93970b167aba2805cc67e1326591f31fbe93ada (patch)
treefefb1abf602475204e443563b634596df9ff5444 /tests/abis
parent56dec0c75358fe42954f9e7949ebd0c163377b10 (diff)
implement support for 3-digit MNC with leading zeros
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout the code base to be able to handle an MNC < 100 that has three digits (leading zeros). The changes to abis_test and gsm0408_test show that this code now handles 3-digit MNC correctly, by not dropping the leading zero as 0xf in the encoded PLMN. Re-implement CTRL commands 'mcc', 'mnc' and 'mcc-mnc-apply' to preserve the presence of the third digit of the MNC. Always reply with all leading zeros. Adjust the expected results in ctrl_test_runner.py, to show that it works. In VTY and CTRL, the parsing of MCC and MNC is inherently made stricter by use of osmo_{mcc,mnc}_from_str() -- they will no longer allow surplus characters and detect errno returned by strtol() (in contrast to atoi()). Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore), Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore), I020a4f11791c61742a3d795f782805f7b7e8733e (libosmocore) Change-Id: I8e722103344186fde118b26d8353db95a4581daa
Diffstat (limited to 'tests/abis')
-rw-r--r--tests/abis/abis_test.c12
-rw-r--r--tests/abis/abis_test.ok6
2 files changed, 7 insertions, 11 deletions
diff --git a/tests/abis/abis_test.c b/tests/abis/abis_test.c
index 6369b0701..bb70a1505 100644
--- a/tests/abis/abis_test.c
+++ b/tests/abis/abis_test.c
@@ -101,8 +101,7 @@ static const struct test_abis_nm_ipaccess_cgi test_abis_nm_ipaccess_cgi_data[] =
.plmn = { .mcc = 1, .mnc = 2, .mnc_3_digits = true },
.lac = 3,
.cell_identity = 4,
- .expect = "00f120" /* FAIL: should be "002100" */
- "0003" "0004",
+ .expect = "002100" "0003" "0004",
},
{
.plmn = { .mcc = 0, .mnc = 0, .mnc_3_digits = false },
@@ -114,8 +113,7 @@ static const struct test_abis_nm_ipaccess_cgi test_abis_nm_ipaccess_cgi_data[] =
.plmn = { .mcc = 0, .mnc = 0, .mnc_3_digits = true },
.lac = 0,
.cell_identity = 0,
- .expect = "00f000" /* FAIL: should be "000000" */
- "0000" "0000",
+ .expect = "000000" "0000" "0000",
},
{
.plmn = { .mcc = 999, .mnc = 999, .mnc_3_digits = false },
@@ -133,8 +131,7 @@ static const struct test_abis_nm_ipaccess_cgi test_abis_nm_ipaccess_cgi_data[] =
.plmn = { .mcc = 909, .mnc = 90, .mnc_3_digits = true },
.lac = 0xabcd,
.cell_identity = 0x2345,
- .expect = "09f909" /* FAIL: should be "090990" */
- "abcd" "2345",
+ .expect = "090990" "abcd" "2345",
},
};
@@ -151,8 +148,7 @@ static void test_abis_nm_ipaccess_cgi()
char *result;
bool ok;
- net.country_code = t->plmn.mcc;
- net.network_code = t->plmn.mnc;
+ net.plmn = t->plmn;
bts.network = &net;
bts.location_area_code = t->lac;
bts.cell_identity = t->cell_identity;
diff --git a/tests/abis/abis_test.ok b/tests/abis/abis_test.ok
index ff7772c07..e7e309c5f 100644
--- a/tests/abis/abis_test.ok
+++ b/tests/abis/abis_test.ok
@@ -8,9 +8,9 @@ SELECTED: 1
SELECTED: 0
test_sw_selection(): OK
test_abis_nm_ipaccess_cgi[0]: result=00f12000030004 pass
-test_abis_nm_ipaccess_cgi[1]: result=00f12000030004 pass
+test_abis_nm_ipaccess_cgi[1]: result=00210000030004 pass
test_abis_nm_ipaccess_cgi[2]: result=00f00000000000 pass
-test_abis_nm_ipaccess_cgi[3]: result=00f00000000000 pass
+test_abis_nm_ipaccess_cgi[3]: result=00000000000000 pass
test_abis_nm_ipaccess_cgi[4]: result=999999ffffffff pass
test_abis_nm_ipaccess_cgi[5]: result=09f909abcd2345 pass
-test_abis_nm_ipaccess_cgi[6]: result=09f909abcd2345 pass
+test_abis_nm_ipaccess_cgi[6]: result=090990abcd2345 pass