Holger Hans Peter Freyther | 5b84115 | 2018-08-29 04:29:56 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | """ |
Holger Hans Peter Freyther | 337141f | 2019-02-23 09:58:59 +0000 | [diff] [blame^] | 3 | Runs a network registration with a 'massive' amount of MS |
Holger Hans Peter Freyther | 5b84115 | 2018-08-29 04:29:56 +0100 | [diff] [blame] | 4 | using the ms_driver infrastructure. |
| 5 | """ |
| 6 | from osmo_gsm_tester.testenv import * |
Holger Hans Peter Freyther | 337141f | 2019-02-23 09:58:59 +0000 | [diff] [blame^] | 7 | from datetime import timedelta |
Holger Hans Peter Freyther | 5b84115 | 2018-08-29 04:29:56 +0100 | [diff] [blame] | 8 | |
Holger Hans Peter Freyther | 337141f | 2019-02-23 09:58:59 +0000 | [diff] [blame^] | 9 | print('Claiming resources for the test') |
Holger Hans Peter Freyther | 5b84115 | 2018-08-29 04:29:56 +0100 | [diff] [blame] | 10 | nitb = suite.nitb() |
| 11 | bts = suite.bts() |
| 12 | ms_driver = suite.ms_driver() |
Holger Hans Peter Freyther | 5e67ed4 | 2019-02-25 09:48:50 +0000 | [diff] [blame] | 13 | modems = suite.all_resources(suite.modem) |
Holger Hans Peter Freyther | 5b84115 | 2018-08-29 04:29:56 +0100 | [diff] [blame] | 14 | |
Holger Hans Peter Freyther | 337141f | 2019-02-23 09:58:59 +0000 | [diff] [blame^] | 15 | print('Launching a simple network') |
Holger Hans Peter Freyther | 5b84115 | 2018-08-29 04:29:56 +0100 | [diff] [blame] | 16 | nitb.bts_add(bts) |
| 17 | nitb.start() |
| 18 | bts.start() |
| 19 | wait(nitb.bts_is_connected, bts) |
| 20 | |
Holger Hans Peter Freyther | 5e67ed4 | 2019-02-25 09:48:50 +0000 | [diff] [blame] | 21 | # Configure all MS that are available to this test. |
| 22 | for modem in modems: |
| 23 | nitb.subscriber_add(modem) |
| 24 | ms_driver.subscriber_add(modem) |
Holger Hans Peter Freyther | 5b84115 | 2018-08-29 04:29:56 +0100 | [diff] [blame] | 25 | |
| 26 | # Run the base test. |
| 27 | ms_driver.run_test() |
| 28 | |
Holger Hans Peter Freyther | 337141f | 2019-02-23 09:58:59 +0000 | [diff] [blame^] | 29 | # Print the stats of the run. |
Holger Hans Peter Freyther | 5b84115 | 2018-08-29 04:29:56 +0100 | [diff] [blame] | 30 | ms_driver.print_stats() |
Holger Hans Peter Freyther | 337141f | 2019-02-23 09:58:59 +0000 | [diff] [blame^] | 31 | |
| 32 | # Evaluate if this run was successful or not. Our initial acceptance criteria |
| 33 | # is quite basic but it should allow us to scale to a larger number of MS and |
| 34 | # reasons (e.g. have a full BCCH). |
| 35 | # |
| 36 | # 99% of LUs should complete |
| 37 | # 99% of successful LUs should complete within 10s. |
| 38 | stats = ms_driver.get_stats() |
| 39 | if len(modems) > 0 and stats.num_completed < 1: |
| 40 | raise Exception("No run completed.") |
| 41 | completion_ratio = stats.num_attempted / stats.num_completed |
| 42 | |
| 43 | # Verify that 99% of LUs completed. |
| 44 | if completion_ratio < 0.99: |
| 45 | raise Exception("Completion ratio of %f%% lower than threshold." % (completion_ratio * 100.0)) |
| 46 | |
| 47 | # Check how many results are below our threshold. |
| 48 | acceptable_delay = timedelta(seconds=30) |
| 49 | results = ms_driver.get_result_values() |
| 50 | quick_enough = 0 |
| 51 | for result in results: |
| 52 | if not result.has_lu_time(): |
| 53 | continue |
| 54 | if timedelta(seconds=result.lu_delay()) >= acceptable_delay: |
| 55 | continue |
| 56 | quick_enough = quick_enough + 1 |
| 57 | |
| 58 | latency_ratio = quick_enough / len(results) |
| 59 | if latency_ratio < 0.99: |
| 60 | raise Exception("Latency ratio of %f%% lower than threshold." % (latency_ratio * 100.0)) |