Pau Espin Pedrol | 7e0b2dd | 2020-03-10 11:46:39 +0100 | [diff] [blame] | 1 | == Resource Resolution |
| 2 | |
| 3 | - A global configuration <<resources_conf,resources.conf>> defines which hardware is plugged to the |
| 4 | {app-name} setup, be it the main unit or any slave unit. This list becomes the |
| 5 | 'resource pool'. |
| 6 | - Each suite contains a number of test scripts. The amount of resources a test |
| 7 | may use is defined by the test suite's <<suite_conf,suite.conf>>. |
| 8 | - Which specific modems, BTS models, NITB IP addresses etc. are made available |
| 9 | to a test run is typically determined by <<suite_conf,suite.conf>> and a combination of <<scenario_conf,scenario |
| 10 | configurations>> -- or picked automatically if not. |
| 11 | |
| 12 | .Example of how to select resources and configurations: scenarios may pick specific resources (here BTS and ARFCN), remaining requirements are picked as available (here two modems and a NITB interface) |
| 13 | [graphviz] |
| 14 | ---- |
| 15 | digraph G { |
| 16 | rankdir=TB; |
| 17 | |
| 18 | suite_scenarios [label="Suite+Scenarios selection\nsms:sysmo+band1800+mod-bts0-chanallocdescend"] |
| 19 | |
| 20 | subgraph { |
| 21 | rank=same; |
| 22 | suite |
| 23 | scenarios |
| 24 | defaults_conf [label="defaults.conf:\nbsc: net: encryption: a5_0"] |
| 25 | } |
| 26 | |
| 27 | subgraph cluster_scenarios { |
| 28 | label = "Scenarios"; |
| 29 | u_sysmoBTS [label="Scenario: sysmo\nresources: bts: type: osmo-bts-sysmo"] |
| 30 | u_trx [label="Scenario: trx\nresources: bts: type: osmo-bts-trx"] |
| 31 | u_arfcn [label="Scenario: band1800\nresources: arfcn: band: GSM-1800"] |
| 32 | u_chanallocdesc [label="Scenario: band1800\nmodifiers: bts: channel_allocator: descending"] |
| 33 | } |
| 34 | |
| 35 | subgraph cluster_suite { |
| 36 | label = "Suite: sms"; |
| 37 | requires [label="Requirements (suite.conf):\nmodem: times: 2\nbts\nip_address\narfcn"] |
| 38 | subgraph cluster_tests { |
| 39 | label = "Test mo_mt_sms.py"; |
| 40 | obj_nitb [label="object NITB\n(process using 10.42.42.2)"] |
| 41 | bts0 [label="object bts[0]"] |
| 42 | modem0 [label="object modem[0]"] |
| 43 | modem1 [label="object modem[1]"] |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | subgraph cluster_resources { |
| 48 | label = "Available Resources (not already allocated by other Osmo-GSM-Tester instance)"; |
| 49 | rankdir=TB; |
| 50 | nitb_addrA [label="NITB interface addr\n10.42.42.1"] |
| 51 | nitb_addrA [label="NITB interface addr\n10.42.42.2"] |
| 52 | ModemA |
| 53 | ModemB |
| 54 | ModemC |
| 55 | sysmoBTS [label="osmo-bts-sysmo"] |
| 56 | osmo_bts_trx [label="osmo-bts-trx"] |
| 57 | arfcnA [label="arfcn: 512\nband: GSM-1800"] |
| 58 | arfcnB [label="arfcn: 540\nband: GSM-1900"] |
| 59 | |
| 60 | arfcnA->arfcnB [style=invis] |
| 61 | nitb_addrA->nitb_addrB [style=invis] |
| 62 | ModemA -> ModemB -> ModemC [style=invis] |
| 63 | sysmoBTS -> osmo_bts_trx [style=invis] |
| 64 | } |
| 65 | |
| 66 | suite_scenarios -> {suite scenarios} |
| 67 | scenarios -> { u_arfcn u_sysmoBTS u_chanallocdesc } |
| 68 | |
| 69 | suite -> requires |
| 70 | requires -> ModemA |
| 71 | requires -> ModemB |
| 72 | requires -> sysmoBTS |
| 73 | requires -> arfcnA |
| 74 | requires -> nitb_addrA |
| 75 | |
| 76 | { u_sysmoBTS u_arfcn } -> requires [label="influences\nresource\nselection"] |
| 77 | u_chanallocdesc -> bts0 [label="influences\nbts[0]\nbehavior"] |
| 78 | defaults_conf -> obj_nitb [label="provides default values"] |
| 79 | } |
| 80 | ---- |
| 81 | |
| 82 | === Resource Reservation for Concurrent Trials |
| 83 | |
| 84 | While a test suite runs, the used resources are noted in a global state |
| 85 | directory in a reserved-resources file. This way, any number of trials may be |
| 86 | run consecutively without resource conflicts. Any test trial will only use |
| 87 | resources that are currently not reserved by any other test suite. The |
| 88 | reservation state is human readable. |
| 89 | |
| 90 | The global state directory is protected by a file lock to allow access by |
| 91 | separate processes. |
| 92 | |
| 93 | Also, the binaries from a trial are never installed system-wide, but are run |
| 94 | with a specific 'LD_LIBRARY_PATH' pointing at the <<trials,trial's inst>>, so that |
| 95 | several trials can run consecutively without conflicting binary versions. For |
| 96 | some specific binaries which require extra permissions (such as osmo-bts-octphy |
| 97 | requiring 'CAP_NET_RAW'), 'patchelf' program is used to modify the binary |
| 98 | 'RPATH' field instead because the OS dynamic linker skips 'LD_LIBRARY_PATH' for |
| 99 | binaries with special permissions. |
| 100 | |
| 101 | Once a test suite run is complete, all its reserved resources are torn down (if |
| 102 | the test scripts have not done so already), and the reservations are released |
| 103 | automatically. |
| 104 | |
| 105 | If required resources are unavailable, the test trial fails. For consecutive |
| 106 | test trials, a test run needs to either wait for resources to become available, |
| 107 | or test suites need to be scheduled to make sense. (*<- TODO*) |
Pau Espin Pedrol | b99b0f3 | 2020-03-17 20:18:30 +0100 | [diff] [blame] | 108 | |
| 109 | === Understanding config parsing process |
| 110 | |
| 111 | include::{srcdir}/chapters/config_mangling.adoc[] |