blob: 306eb819a429f1996ab0dd4863ea67d9764ab9a4 [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')
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +010010nitb = suite.nitb()
11bts = suite.bts()
12ms_driver = suite.ms_driver()
Holger Hans Peter Freyther5e67ed42019-02-25 09:48:50 +000013modems = suite.all_resources(suite.modem)
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +010014
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +000015print('Launching a simple network')
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +010016nitb.bts_add(bts)
17nitb.start()
18bts.start()
19wait(nitb.bts_is_connected, bts)
20
Holger Hans Peter Freyther5e67ed42019-02-25 09:48:50 +000021# Configure all MS that are available to this test.
22for modem in modems:
23 nitb.subscriber_add(modem)
24 ms_driver.subscriber_add(modem)
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +010025
26# Run the base test.
27ms_driver.run_test()
28
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +000029# Print the stats of the run.
Holger Hans Peter Freyther5b841152018-08-29 04:29:56 +010030ms_driver.print_stats()
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +000031
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.
38stats = ms_driver.get_stats()
39if len(modems) > 0 and stats.num_completed < 1:
40 raise Exception("No run completed.")
Holger Hans Peter Freyther839d6fa2019-04-28 11:38:21 +010041completion_ratio = stats.num_completed / stats.num_attempted
Holger Hans Peter Freyther337141f2019-02-23 09:58:59 +000042
43# Verify that 99% of LUs completed.
44if 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.
48acceptable_delay = timedelta(seconds=30)
49results = ms_driver.get_result_values()
50quick_enough = 0
51for 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
58latency_ratio = quick_enough / len(results)
59if latency_ratio < 0.99:
60 raise Exception("Latency ratio of %f%% lower than threshold." % (latency_ratio * 100.0))