summaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester/config.py
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-09-12 15:02:25 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-09-12 17:06:57 +0200
commit97e9e355bf4dfffa6abbbfad69626ef662ae8ef2 (patch)
tree267659287c660d70f36c67360778200568106c35 /src/osmo_gsm_tester/config.py
parent6e96f494dc4568164af48d76f72b1e1b4dd0f779 (diff)
config: replicate_times: insert replicates in place
In the following suite.conf, position matters when matching against scenarios: [suite.conf] resources: bts: - type: sysmo times: 2 - type: osmo-bts-trx times: 1 [scenario] resources: bts: - - ip_addr: 1.2.3.4 In this case, for instance, we make it clear that we want the second sysmo bts which has IP 1.2.3.4. With old behaviour, the replicated sysmo would have been created at the end (3rd position), and the ip_addr would match against the osmo-bts-trx BTS. Change-Id: Id78e2326db964d5efb6648854b57d8addce4deb0
Diffstat (limited to 'src/osmo_gsm_tester/config.py')
-rw-r--r--src/osmo_gsm_tester/config.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/osmo_gsm_tester/config.py b/src/osmo_gsm_tester/config.py
index a0fe969..4e7f504 100644
--- a/src/osmo_gsm_tester/config.py
+++ b/src/osmo_gsm_tester/config.py
@@ -277,13 +277,13 @@ def replicate_times(d):
'replicate items that have a "times" > 1'
d = copy.deepcopy(d)
for key, item_list in d.items():
- more_items = []
- for item in item_list:
- times = int(item.pop('times'))
- if times and times > 1:
- for i in range(times - 1):
- more_items.append(copy.deepcopy(item))
- item_list.extend(more_items)
+ idx = 0
+ while idx < len(item_list):
+ item = item_list[idx]
+ times = int(item.pop('times', 1))
+ for j in range(1, times):
+ item_list.insert(idx + j, copy.deepcopy(item))
+ idx += times
return d
# vim: expandtab tabstop=4 shiftwidth=4