After discussions with Neels, the good way to solve this seems a bit complex and we are postponing this for a while until there's more real/urgent need for this.
Right now, we do the following:
- grab state lock
- intersect free "resources" dictionary/set with "scenarios" dictionary/set.
- Then, 1 permutation/possibility of this intersection of resources is used and reserved for the test.
- free the lock
The summary is that specific logic needs to be added while having the state file lock grabbed which does a second step of resolution through all the possibles permutations to find the one which validates the following requirements and then reserve that specific ARFCN dynamically. This step has actually 2 sub-steps:
- all objects share a given band
- an ARFCN resource is free for that band.
suite.conf must specify how many ARFCN resources are required.
- If no band and arfcn are specified, the complete process with the 2 steps above is run.
- If band is specified but no arfcn is specified, the the code validates that resources (bts and modem) support the same band specified by checking the "bands" attribute. Sub-step 2 is then run to try to allocate an ARFCN for that band.
- If band and arfcn is specified, only try to allocate that arfcn (and fail if not possible, same for all cases explained above).
============================
See an example here:
free resources: {
modem: { ... , bands: [ x, y ] }, # let's call this modem "A"
modem: { ... , bands: [ z ] }, # let's call this modem "B"
modem: { ... , bands: [ x, z ] }, # let's call this modem "C"
bts; { ..., bands [ x, z ], # let's call this BTS "D"
# no free arfcn for band X, 2 free arfcns for band Z
arfcn: { arfcn: 50, band = z },
arfcn: { arfcn: 60, band = z },
}
scenario:
{ # no requirements
}
suite.conf:
{
modem:
times: 2
bts:
times: 1
}
- Current code (already existing) creates a subset "intersect" by intersecting free resources with scenario (in this case the subset is the same as free resources because scenario is empty).
- With this "intersect" set, we create a set list of permutations based on different objects of type "bts" and "modem" which fullfill the requirements for suite.conf, and we iterate over it: [A+B+D], [A+C+D], [B+C+D]
- [A+B+D] --> No common band between them, skip
- [A+C+D] --> Common band "X" between them, but there's no free arfcn resource for band X, so we skip too
- [B+C+D] --> Common band "Z", and we successfully allocate firs tarfcn available for that band: 50
Then this resource is during the test fetched through suite.py and we pass that to BTS and modem (in ofono implmentation we just don't use it as we don't need it).
============================
Similar process can be applied for "ciphers" attribute for instance, which has the issue, although it's not that important because only first requirement is needed in this case (because there's no limited cipher resources) and because all modems so far support a5 0 (which we are using by default).
We could extend this by somehow specifying "air groups", which would basically allow to specify which/how many modems and bts need to share a band. For instance, "this 2 modems and this bts should use same frequency" and "this other modem with htis BTS should use another one".