bsc: Add API to mock BSC RSL IP addr

Change-Id: I9ca67964e656943b50967a27a88054fd3e484672
diff --git a/src/osmo_gsm_tester/osmo_bsc.py b/src/osmo_gsm_tester/osmo_bsc.py
index 2c909bc..323b9ec 100644
--- a/src/osmo_gsm_tester/osmo_bsc.py
+++ b/src/osmo_gsm_tester/osmo_bsc.py
@@ -31,6 +31,7 @@
     process = None
     bts = None
     encryption = None
+    rsl_ip = None
     mgw = None
     stp = None
 
@@ -92,6 +93,9 @@
             encryption_vty = util.encryption2osmovty(values['bsc']['net']['encryption'])
         config.overlay(values, dict(bsc=dict(net=dict(encryption=encryption_vty))))
 
+        if self.rsl_ip is not None:
+            config.overlay(values, dict(bsc=dict(net=dict(rsl_ip=self.rsl_ip))))
+
         self.dbg('BSC CONFIG:\n' + pprint.pformat(values))
 
         with open(self.config_file, 'w') as f:
@@ -105,6 +109,12 @@
     def set_encryption(self, val):
         self.encryption = val
 
+    def set_rsl_ip(self, ip_addr):
+        '''Overwrite RSL IPaddr option sent to all BTS during OML config. Useful
+        for tests only willing to use osmo-bsc to do the OML setup but using
+        other external entities to test the RSL path, such as TTCN3 tests.'''
+        self.rsl_ip = ip_addr
+
     def bts_add(self, bts):
         self.bts.append(bts)
         bts.set_bsc(self)
diff --git a/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
index 71b44cf..814cf97 100644
--- a/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
@@ -52,6 +52,9 @@
   channel allocator ascending
   rach tx integer 9
   rach max transmission 7
+% if bsc.net.get('rsl_ip', False):
+  ip.access rsl-ip ${bsc.net.rsl_ip}
+% endif
   ip.access unit_id ${bts.ipa_unit_id} 0
   oml ip.access stream_id ${bts.stream_id} line 0
 % if bts.get('sgsn', False):