aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-05-17 18:59:58 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-05-24 22:05:49 +0200
commit25ff634b5eb06bc1411125dd01efae246e976c4a (patch)
tree8a32b740427178edeca975bee185888ebcb46d89 /tests
parentb1998511432c806d9a671bd089a36fc461f216b0 (diff)
ctrl: Introduce CTRL SET cmd to apply VTY cfg file
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/ctrl/osmo-bsc-apply-config-file-invalid.cfg2
-rw-r--r--tests/ctrl/osmo-bsc-apply-config-file.cfg55
-rwxr-xr-xtests/ctrl_test_runner.py38
4 files changed, 97 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6bc78392e..5e23be0a4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -42,6 +42,8 @@ EXTRA_DIST = \
timer.vty \
power_ctrl.vty \
ctrl/osmo-bsc-neigh-test.cfg \
+ ctrl/osmo-bsc-apply-config-file.cfg \
+ ctrl/osmo-bsc-apply-config-file-invalid.cfg \
$(NULL)
TESTSUITE = $(srcdir)/testsuite
diff --git a/tests/ctrl/osmo-bsc-apply-config-file-invalid.cfg b/tests/ctrl/osmo-bsc-apply-config-file-invalid.cfg
new file mode 100644
index 000000000..b819f7dc2
--- /dev/null
+++ b/tests/ctrl/osmo-bsc-apply-config-file-invalid.cfg
@@ -0,0 +1,2 @@
+network
+ btssss-invalid-cmd
diff --git a/tests/ctrl/osmo-bsc-apply-config-file.cfg b/tests/ctrl/osmo-bsc-apply-config-file.cfg
new file mode 100644
index 000000000..1a069ce75
--- /dev/null
+++ b/tests/ctrl/osmo-bsc-apply-config-file.cfg
@@ -0,0 +1,55 @@
+network
+ bts 1
+ type osmo-bts
+ band DCS1800
+ cell_identity 123
+ location_area_code 1
+ base_station_id_code 55
+ ms max power 15
+ cell reselection hysteresis 4
+ rxlev access min 0
+ radio-link-timeout 32
+ channel allocator ascending
+ rach tx integer 9
+ rach max transmission 7
+ channel-description attach 1
+ channel-description bs-pa-mfrms 5
+ channel-description bs-ag-blks-res 1
+ early-classmark-sending forbidden
+ ipa unit-id 55 0
+ oml ipa stream-id 255 line 0
+ codec-support fr
+ gprs mode gprs
+ gprs routing area 6
+ neighbor bts 0
+ trx 0
+ rf_locked 0
+ arfcn 880
+ nominal power 23
+ ! to use full TRX power, set max_power_red 0
+ max_power_red 20
+ rsl e1 tei 0
+ timeslot 0
+ phys_chan_config CCCH+SDCCH4
+ hopping enabled 0
+ timeslot 1
+ phys_chan_config TCH/F
+ hopping enabled 0
+ timeslot 2
+ phys_chan_config TCH/F
+ hopping enabled 0
+ timeslot 3
+ phys_chan_config TCH/F
+ hopping enabled 0
+ timeslot 4
+ phys_chan_config TCH/F
+ hopping enabled 0
+ timeslot 5
+ phys_chan_config TCH/F
+ hopping enabled 0
+ timeslot 6
+ phys_chan_config TCH/F
+ hopping enabled 0
+ timeslot 7
+ phys_chan_config TCH/F
+ hopping enabled 0
diff --git a/tests/ctrl_test_runner.py b/tests/ctrl_test_runner.py
index 501b917b5..64f93fc1d 100755
--- a/tests/ctrl_test_runner.py
+++ b/tests/ctrl_test_runner.py
@@ -488,6 +488,44 @@ class TestCtrlBSC(TestCtrlBase):
self.assertEqual(r['var'], 'mcc')
self.assertEqual(r['value'], '002')
+
+ def testApplyConfigFile(self):
+
+ vty_file = os.path.join(confpath, 'tests/ctrl/osmo-bsc-apply-config-file.cfg')
+ vty_file_invalid = os.path.join(confpath, 'tests/ctrl/osmo-bsc-apply-config-file-invalid.cfg')
+
+ # Test some invalid input
+ r = self.do_set('apply-config-file', 'wrong-file-name-nonexistent')
+ self.assertEqual(r['mtype'], 'ERROR')
+
+ # Test some existing file with invalid content
+ r = self.do_set('apply-config-file', vty_file_invalid)
+ self.assertEqual(r['mtype'], 'ERROR')
+
+ #bts1 shouldn't exist yet, let's check:
+ r = self.do_get('bts.1.location-area-code')
+ self.assertEqual(r['mtype'], 'ERROR')
+ self.assertEqual(r['error'], 'Error while resolving object')
+
+ r = self.do_set('apply-config-file', vty_file)
+ print('respose: ' + str(r))
+ self.assertEqual(r['mtype'], 'SET_REPLY')
+ self.assertEqual(r['var'], 'apply-config-file')
+ self.assertEqual(r['value'], 'OK')
+
+ # BTS1 should exist now:
+ r = self.do_get('bts.1.location-area-code')
+ self.assertEqual(r['mtype'], 'GET_REPLY')
+ self.assertEqual(r['var'], 'bts.1.location-area-code')
+ self.assertEqual(r['value'], '1')
+
+ # Set it again
+ r = self.do_set('apply-config-file', vty_file)
+ self.assertEqual(r['mtype'], 'SET_REPLY')
+ self.assertEqual(r['var'], 'apply-config-file')
+ self.assertEqual(r['value'], 'OK')
+
+
class TestCtrlBSCNeighbor(TestCtrlBase):
def tearDown(self):