blob: d596b683ace9c271d273cb6c994e3967e3274b81 [file] [log] [blame]
Neels Hofmeyraea2f2c2017-05-18 22:01:59 +02001#!/usr/bin/env python3
2from osmo_gsm_tester.test import *
3hlr = suite.hlr()
4bts = suite.bts()
5mgcpgw = suite.mgcpgw(bts_ip=bts.remote_addr())
6msc = suite.msc(hlr, mgcpgw)
7bsc = suite.bsc(msc)
Neels Hofmeyr6743c0c2017-06-13 16:26:06 +02008stp = suite.stp()
Neels Hofmeyraea2f2c2017-05-18 22:01:59 +02009modems = suite.modems(int(prompt('How many modems?')))
10
11hlr.start()
Neels Hofmeyr6743c0c2017-06-13 16:26:06 +020012stp.start()
Neels Hofmeyraea2f2c2017-05-18 22:01:59 +020013msc.start()
Pau Espin Pedrol1ba2ded2017-05-30 16:39:44 +020014mgcpgw.start()
Neels Hofmeyraea2f2c2017-05-18 22:01:59 +020015
16bsc.bts_add(bts)
17bsc.start()
18
19bts.start()
20
21for m in modems:
22 hlr.subscriber_add(m)
Pau Espin Pedrol0e57aad2017-05-29 14:25:22 +020023 m.connect(msc.mcc_mnc())
Neels Hofmeyraea2f2c2017-05-18 22:01:59 +020024
25while True:
26 cmd = prompt('Enter command: (q)uit (s)ms (g)et-registered (w)ait-registered')
27 cmd = cmd.strip().lower()
28
29 if not cmd:
30 continue
31 if 'quit'.startswith(cmd):
32 break
33 elif 'wait-registered'.startswith(cmd):
34 try:
Pau Espin Pedrol0e57aad2017-05-29 14:25:22 +020035 for m in modems:
36 wait(m.is_connected, msc.mcc_mnc())
Neels Hofmeyraea2f2c2017-05-18 22:01:59 +020037 wait(msc.subscriber_attached, *modems)
38 except Timeout:
39 print('Timeout while waiting for registration.')
40 elif 'get-registered'.startswith(cmd):
41 print(msc.imsi_list_attached())
42 print('RESULT: %s' %
43 ('All modems are registered.' if msc.subscriber_attached(*modems)
44 else 'Some modem(s) not registered yet.'))
45 elif 'sms'.startswith(cmd):
46 for mo in modems:
47 for mt in modems:
48 mo.sms_send(mt.msisdn, 'to ' + mt.name())