osmo-gsm-tester[master]: config: Fix combination of lists

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Sep 7 14:54:25 UTC 2017


Patch Set 2: Code-Review-1

(1 comment)

we discussed today and found a solution.
The intention is indeed to become more strict by combining the lists.
But the algorithm needs a fix, because if we request more than one of the same resource, we have lists of dicts that need to be matched up by index:

  bts:
  - type: sysmo
    times: 2

becomes

  bts: [ {type: sysmo}, {type: sysmo} ]

(mark -1 to wait for new patch set)

https://gerrit.osmocom.org/#/c/3722/2/src/osmo_gsm_tester/config.py
File src/osmo_gsm_tester/config.py:

Line 249:             assert type(dest[i]) == type(src[i])
> I think I never saw any checks for tuples in this code, so if I understand 
Notes from discussion:

There are two kinds of lists: a list of dicts representing more of one resource kind; a list of resource features like string tokens. The list of resources needs to be treated by matching up indexes, the list of string tokens needs to be combined like taking the union of two sets (making the requirements stricter by adding more tokens, think a list of features becoming stricter).

Pseudocode of what this needs to do:

  # sanity: the lists aren't mixed and match each other
  foreach src + dst:
    assert all types match
   
  # treat resource lists differently from sets of features
  if any([is_list(i) or is_dict(i) for i in src+dst]):
    combine(src, dst) # recurse, as in list of resources
  else:
    dst = union(src, dst) # enlarge list of features


-- 
To view, visit https://gerrit.osmocom.org/3722
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7a38f10eb9de338a77bf1fa3afceb9df1532015
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-HasComments: Yes



More information about the gerrit-log mailing list