aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ctrl_test_runner.py
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/ctrl_test_runner.py
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/ctrl_test_runner.py')
-rwxr-xr-xtests/ctrl_test_runner.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/ctrl_test_runner.py b/tests/ctrl_test_runner.py
index 41765ffc6..f43c09a79 100755
--- a/tests/ctrl_test_runner.py
+++ b/tests/ctrl_test_runner.py
@@ -371,32 +371,32 @@ class TestCtrlBSC(TestCtrlBase):
r = self.do_get('mcc')
self.assertEquals(r['mtype'], 'GET_REPLY')
self.assertEquals(r['var'], 'mcc')
- self.assertEquals(r['value'], '23')
+ self.assertEquals(r['value'], '023')
r = self.do_set('mcc', '023')
r = self.do_get('mcc')
self.assertEquals(r['mtype'], 'GET_REPLY')
self.assertEquals(r['var'], 'mcc')
- self.assertEquals(r['value'], '23')
+ self.assertEquals(r['value'], '023')
def testMnc(self):
r = self.do_set('mnc', '9')
r = self.do_get('mnc')
self.assertEquals(r['mtype'], 'GET_REPLY')
self.assertEquals(r['var'], 'mnc')
- self.assertEquals(r['value'], '9')
+ self.assertEquals(r['value'], '09')
r = self.do_set('mnc', '09')
r = self.do_get('mnc')
self.assertEquals(r['mtype'], 'GET_REPLY')
self.assertEquals(r['var'], 'mnc')
- self.assertEquals(r['value'], '9')
+ self.assertEquals(r['value'], '09')
r = self.do_set('mnc', '009')
r = self.do_get('mnc')
self.assertEquals(r['mtype'], 'GET_REPLY')
self.assertEquals(r['var'], 'mnc')
- self.assertEquals(r['value'], '9') # FAIL: expecting '009'
+ self.assertEquals(r['value'], '009')
def testMccMncApply(self):
@@ -434,7 +434,7 @@ class TestCtrlBSC(TestCtrlBase):
r = self.do_get('mnc')
self.assertEquals(r['mtype'], 'GET_REPLY')
self.assertEquals(r['var'], 'mnc')
- self.assertEquals(r['value'], '4')
+ self.assertEquals(r['value'], '04')
r = self.do_get('mcc')
self.assertEquals(r['mtype'], 'GET_REPLY')
@@ -450,7 +450,7 @@ class TestCtrlBSC(TestCtrlBase):
r = self.do_get('mnc')
self.assertEquals(r['mtype'], 'GET_REPLY')
self.assertEquals(r['var'], 'mnc')
- self.assertEquals(r['value'], '3')
+ self.assertEquals(r['value'], '03')
r = self.do_get('mcc')
self.assertEquals(r['mtype'], 'GET_REPLY')
@@ -466,12 +466,12 @@ class TestCtrlBSC(TestCtrlBase):
r = self.do_get('mnc')
self.assertEquals(r['mtype'], 'GET_REPLY')
self.assertEquals(r['var'], 'mnc')
- self.assertEquals(r['value'], '3') # FAIL: expecting '003'
+ self.assertEquals(r['value'], '003')
r = self.do_get('mcc')
self.assertEquals(r['mtype'], 'GET_REPLY')
self.assertEquals(r['var'], 'mcc')
- self.assertEquals(r['value'], '2')
+ self.assertEquals(r['value'], '002')
# Set same MNC with 3 digits
r = self.do_set('mcc-mnc-apply', '2,003')
@@ -482,12 +482,12 @@ class TestCtrlBSC(TestCtrlBase):
r = self.do_get('mnc')
self.assertEquals(r['mtype'], 'GET_REPLY')
self.assertEquals(r['var'], 'mnc')
- self.assertEquals(r['value'], '3') # FAIL: expecting '003'
+ self.assertEquals(r['value'], '003')
r = self.do_get('mcc')
self.assertEquals(r['mtype'], 'GET_REPLY')
self.assertEquals(r['var'], 'mcc')
- self.assertEquals(r['value'], '2')
+ self.assertEquals(r['value'], '002')
class TestCtrlNAT(TestCtrlBase):