blob: f6b94ad520831211ccd5833c37d31d5500677d7f [file] [log] [blame]
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +01001#!/usr/bin/env python3
2"""
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +00003Runs a network registration with a 'massive' amount of MS
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +01004using the ms_driver infrastructure.
5"""
6from osmo_gsm_tester.testenv import *
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +00007from datetime import timedelta
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +01008
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +00009print('Claiming resources for the test')
Pau Espin Pedrol40c7bc72020-05-05 13:41:42 +020010nitb = tenv.nitb()
11bts = tenv.bts()
12ms_driver = tenv.ms_driver()
Holger Hans Peter Freyther2e7e8432019-04-30 18:55:59 +010013ul = ms_driver.add_test('ul_test')
Pau Espin Pedrol40c7bc72020-05-05 13:41:42 +020014modems = tenv.all_resources(tenv.modem)
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +010015
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +000016print('Launching a simple network')
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +010017nitb.bts_add(bts)
18nitb.start()
19bts.start()
20wait(nitb.bts_is_connected, bts)
21
Holger Hans Peter Freyther5e67ed42019-02-25 09:48:50 +000022# Configure all MS that are available to this test.
23for modem in modems:
24 nitb.subscriber_add(modem)
25 ms_driver.subscriber_add(modem)
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +010026
27# Run the base test.
28ms_driver.run_test()
29
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +000030# Print the stats of the run.
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +010031ms_driver.print_stats()
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +000032
33# Evaluate if this run was successful or not. Our initial acceptance criteria
34# is quite basic but it should allow us to scale to a larger number of MS and
35# reasons (e.g. have a full BCCH).
36#
37# 99% of LUs should complete
38# 99% of successful LUs should complete within 10s.
Holger Hans Peter Freyther2e7e8432019-04-30 18:55:59 +010039stats = ul.get_stats()
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +000040if len(modems) > 0 and stats.num_completed < 1:
41 raise Exception("No run completed.")
Holger Hans Peter Freyther839d6fa2019-04-28 11:38:21 +010042completion_ratio = stats.num_completed / stats.num_attempted
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +000043
44# Verify that 99% of LUs completed.
45if completion_ratio < 0.99:
46 raise Exception("Completion ratio of %f%% lower than threshold." % (completion_ratio * 100.0))
47
48# Check how many results are below our threshold.
49acceptable_delay = timedelta(seconds=30)
Holger Hans Peter Freyther2e7e8432019-04-30 18:55:59 +010050quick_enough = len(ul.lus_less_than(acceptable_delay))
Holger Hans Peter Freyther61f28772019-04-27 14:25:22 +010051latency_ratio = quick_enough / stats.num_attempted
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +000052if latency_ratio < 0.99:
53 raise Exception("Latency ratio of %f%% lower than threshold." % (latency_ratio * 100.0))