bts: Recreate resources.conf trx_list with len based on num_trx
We are already doing this for defaults.cfg, but not for resources.conf.
As a result, if we have a trx_list with 2 trx but we have set num_trx=1
(default), parsing will fail later in bsc.cfg.tmpl because
conf_for_bsc_prepare() will pass a trx_list with 2 trx.
Change-Id: I28ed34abeedaa0ee2e7862ced45a46042192d831
diff --git a/src/osmo_gsm_tester/bts.py b/src/osmo_gsm_tester/bts.py
index ca33eb4..0f3ef1c 100644
--- a/src/osmo_gsm_tester/bts.py
+++ b/src/osmo_gsm_tester/bts.py
@@ -20,6 +20,7 @@
import os
import pprint
import tempfile
+import copy
from abc import ABCMeta, abstractmethod
from . import log, config, util, template, process, schema, pcu_osmo
@@ -112,7 +113,12 @@
config.overlay(values, { 'cell_identity': self.cellid })
if self.bvci is not None:
config.overlay(values, { 'bvci': self.bvci })
- config.overlay(values, self.conf)
+
+ conf = copy.deepcopy(self.conf)
+ trx_list = conf.get('trx_list')
+ if trx_list and len(trx_list) != self.num_trx():
+ conf['trx_list'] = Bts._trx_list_recreate(trx_list, self.num_trx())
+ config.overlay(values, conf)
sgsn_conf = {} if self.sgsn is None else self.sgsn.conf_for_client()
config.overlay(values, sgsn_conf)