bsc/nitb: Allow to set the GPRS mode through the ctrl command

Create a control command to read and modify the gprs mode. Use
the get_string_value to indicate if the value was found or not.
This is useful for the ctrl interface where I didn't want to
replicate "none", "gprs" and "egprs". Share code to verify that
a BTS supports the mode.

Related: SYS#591
diff --git a/openbsc/tests/ctrl_test_runner.py b/openbsc/tests/ctrl_test_runner.py
index a1e1d4d..502da76 100644
--- a/openbsc/tests/ctrl_test_runner.py
+++ b/openbsc/tests/ctrl_test_runner.py
@@ -491,6 +491,25 @@
         self.assertEquals(r['mtype'], 'SET_REPLY')
         self.assertEquals(r['value'], 'Tried to drop the BTS')
 
+    def testGprsMode(self):
+        r = self.do_get('bts.0.gprs-mode')
+        self.assertEquals(r['mtype'], 'GET_REPLY')
+        self.assertEquals(r['var'], 'bts.0.gprs-mode')
+        self.assertEquals(r['value'], 'none')
+
+        r = self.do_set('bts.0.gprs-mode', 'bla')
+        self.assertEquals(r['mtype'], 'ERROR')
+        self.assertEquals(r['error'], 'Mode is not known')
+
+        r = self.do_set('bts.0.gprs-mode', 'egprs')
+        self.assertEquals(r['mtype'], 'SET_REPLY')
+        self.assertEquals(r['value'], 'egprs')
+
+        r = self.do_get('bts.0.gprs-mode')
+        self.assertEquals(r['mtype'], 'GET_REPLY')
+        self.assertEquals(r['var'], 'bts.0.gprs-mode')
+        self.assertEquals(r['value'], 'egprs')
+
 class TestCtrlNAT(TestCtrlBase):
 
     def ctrl_command(self):