bsc: Allow tests to select network encryption

Nowadays encryption parameter in bsc needs to be set to the same cipher as
the one specified in msc, otherwise the cipher negotation will fail.

See OS#2461 for more information on the matter.

Change-Id: I857b3860fb771b36fb3d587d4e92b320f0685a19
diff --git a/src/osmo_gsm_tester/osmo_bsc.py b/src/osmo_gsm_tester/osmo_bsc.py
index efbda1f..2eb23fb 100644
--- a/src/osmo_gsm_tester/osmo_bsc.py
+++ b/src/osmo_gsm_tester/osmo_bsc.py
@@ -29,6 +29,7 @@
     config_file = None
     process = None
     bts = None
+    encryption = None
 
     def __init__(self, suite_run, msc, ip_address):
         super().__init__(log.C_RUN, 'osmo-bsc_%s' % ip_address.get('addr'))
@@ -81,6 +82,10 @@
             bts_list.append(bts.conf_for_bsc())
         config.overlay(values, dict(bsc=dict(net=dict(bts_list=bts_list))))
 
+        # runtime parameters:
+        if self.encryption is not None:
+            config.overlay(values, dict(bsc=dict(net=dict(encryption=self.encryption))))
+
         self.dbg('BSC CONFIG:\n' + pprint.pformat(values))
 
         with open(self.config_file, 'w') as f:
@@ -91,6 +96,9 @@
     def addr(self):
         return self.ip_address.get('addr')
 
+    def set_encryption(self, val):
+        self.encryption = val
+
     def bts_add(self, bts):
         self.bts.append(bts)
         bts.set_bsc(self)