summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-08-24 17:21:51 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-08-24 18:09:07 +0200
commite913e3719a450fff0498efef17b52ce1a9f5b447 (patch)
tree8063d4002e3827ac988631cc5722d05bd7f88c8f
parent3fa6e12b78b59cef269bab0362c4390beeff02d3 (diff)
Introduce aoip_encryption suite
This suite aims testing different authentication and encryption setups. Change-Id: I5816ecc19a818e5b821fbc6272c9f37f9650ae10
-rw-r--r--example/default-suites.conf1
-rwxr-xr-xsuites/aoip_encryption/register_a5_0_authopt.py34
-rwxr-xr-xsuites/aoip_encryption/register_a5_0_authreq.py47
-rwxr-xr-xsuites/aoip_encryption/register_a5_1_authreq.py47
-rw-r--r--suites/aoip_encryption/suite.conf10
5 files changed, 139 insertions, 0 deletions
diff --git a/example/default-suites.conf b/example/default-suites.conf
index 72a90db..4904844 100644
--- a/example/default-suites.conf
+++ b/example/default-suites.conf
@@ -4,3 +4,4 @@
- aoip_sms:trx-b200
- smpp
- aoip_smpp
+- aoip_encryption
diff --git a/suites/aoip_encryption/register_a5_0_authopt.py b/suites/aoip_encryption/register_a5_0_authopt.py
new file mode 100755
index 0000000..ff93cb8
--- /dev/null
+++ b/suites/aoip_encryption/register_a5_0_authopt.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+from osmo_gsm_tester.test import *
+
+hlr = suite.hlr()
+bts = suite.bts()
+mgcpgw = suite.mgcpgw(bts_ip=bts.remote_addr())
+msc = suite.msc(hlr, mgcpgw)
+bsc = suite.bsc(msc)
+stp = suite.stp()
+ms = suite.modem()
+
+print('start network...')
+msc.set_authentication(False)
+msc.set_encryption('a5 0')
+bsc.set_encryption('a5 0')
+hlr.start()
+stp.start()
+msc.start()
+mgcpgw.start()
+bsc.bts_add(bts)
+bsc.start()
+bts.start()
+
+ms.log_info()
+good_ki = ms.ki()
+bad_ki = ("%1X" % (int(good_ki[0], 16) ^ 0x01)) + good_ki[1:]
+
+print('KI changed: ' + good_ki + " => " + bad_ki)
+ms.set_ki(bad_ki)
+hlr.subscriber_add(ms)
+print('Attempt connection with wrong KI, should work as it is not used...')
+ms.connect(msc.mcc_mnc())
+wait(ms.is_connected, msc.mcc_mnc())
+wait(msc.subscriber_attached, ms)
diff --git a/suites/aoip_encryption/register_a5_0_authreq.py b/suites/aoip_encryption/register_a5_0_authreq.py
new file mode 100755
index 0000000..be8f8a1
--- /dev/null
+++ b/suites/aoip_encryption/register_a5_0_authreq.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+from osmo_gsm_tester.test import *
+
+hlr = suite.hlr()
+bts = suite.bts()
+mgcpgw = suite.mgcpgw(bts_ip=bts.remote_addr())
+msc = suite.msc(hlr, mgcpgw)
+bsc = suite.bsc(msc)
+stp = suite.stp()
+ms = suite.modem()
+
+print('start network...')
+msc.set_authentication(True)
+msc.set_encryption('a5 0')
+bsc.set_encryption('a5 0')
+hlr.start()
+stp.start()
+msc.start()
+mgcpgw.start()
+bsc.bts_add(bts)
+bsc.start()
+bts.start()
+
+ms.log_info()
+good_ki = ms.ki()
+bad_ki = ("%1X" % (int(good_ki[0], 16) ^ 0x01)) + good_ki[1:]
+
+print('KI changed: ' + good_ki + " => " + bad_ki)
+ms.set_ki(bad_ki)
+hlr.subscriber_add(ms)
+print('Attempt connection with wrong KI...')
+ms.connect(msc.mcc_mnc())
+
+sleep(30) # TODO: read pcap or CTRL interface and look for Rejected? (gsm_a.dtap.msg_mm_type == 0x04)
+print('Asserting modem did not register')
+# FIXME: this can fail because ofono qmi signals registered before being accepted by network. See OS#2458
+# assert not ms.is_connected(msc.mcc_mnc())
+assert not msc.subscriber_attached(ms)
+
+hlr.subscriber_delete(ms)
+print('KI changed: ' + bad_ki + " => " + good_ki)
+ms.set_ki(good_ki)
+hlr.subscriber_add(ms, ms.msisdn)
+print('Attempt connection with correct KI...')
+ms.connect(msc.mcc_mnc())
+wait(ms.is_connected, msc.mcc_mnc())
+wait(msc.subscriber_attached, ms)
diff --git a/suites/aoip_encryption/register_a5_1_authreq.py b/suites/aoip_encryption/register_a5_1_authreq.py
new file mode 100755
index 0000000..dd41348
--- /dev/null
+++ b/suites/aoip_encryption/register_a5_1_authreq.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+from osmo_gsm_tester.test import *
+
+hlr = suite.hlr()
+bts = suite.bts()
+mgcpgw = suite.mgcpgw(bts_ip=bts.remote_addr())
+msc = suite.msc(hlr, mgcpgw)
+bsc = suite.bsc(msc)
+stp = suite.stp()
+ms = suite.modem()
+
+print('start network...')
+msc.set_authentication(True)
+msc.set_encryption('a5 1')
+bsc.set_encryption('a5 1')
+hlr.start()
+stp.start()
+msc.start()
+mgcpgw.start()
+bsc.bts_add(bts)
+bsc.start()
+bts.start()
+
+ms.log_info()
+good_ki = ms.ki()
+bad_ki = ("%1X" % (int(good_ki[0], 16) ^ 0x01)) + good_ki[1:]
+
+print('KI changed: ' + good_ki + " => " + bad_ki)
+ms.set_ki(bad_ki)
+hlr.subscriber_add(ms)
+print('Attempt connection with wrong KI...')
+ms.connect(msc.mcc_mnc())
+
+sleep(30) # TODO: read pcap or CTRL interface and look for Rejected? (gsm_a.dtap.msg_mm_type == 0x04)
+print('Asserting modem did not register')
+# FIXME: this can fail because ofono qmi signals registered before being accepted by network. See OS#2458
+# assert not ms.is_connected(msc.mcc_mnc())
+assert not msc.subscriber_attached(ms)
+
+hlr.subscriber_delete(ms)
+print('KI changed: ' + bad_ki + " => " + good_ki)
+ms.set_ki(good_ki)
+hlr.subscriber_add(ms, ms.msisdn)
+print('Attempt connection with correct KI...')
+ms.connect(msc.mcc_mnc())
+wait(ms.is_connected, msc.mcc_mnc())
+wait(msc.subscriber_attached, ms)
diff --git a/suites/aoip_encryption/suite.conf b/suites/aoip_encryption/suite.conf
new file mode 100644
index 0000000..3cdc525
--- /dev/null
+++ b/suites/aoip_encryption/suite.conf
@@ -0,0 +1,10 @@
+resources:
+ ip_address:
+ - times: 5 # msc, bsc, hlr, stp, mgw
+ bts:
+ - times: 1
+ modem:
+ - times: 1
+
+defaults:
+ timeout: 120s