diff options
author | Oliver Smith <osmith@sysmocom.de> | 2020-04-01 13:13:50 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2020-05-06 13:42:26 +0200 |
commit | 7b4e5b1390cad9087e5d8f7b8b3344b9e2c677fa (patch) | |
tree | a4da142a13df84f721c7ee2cdad015315211f252 /tests | |
parent | 502f10fb0ca59d15aaa3f3874333f2e384ed53e9 (diff) |
VTY: alloc/dealloc/show imsi pseudo
Create VTY commands and related database functions to get, allocate and
deallocate pseudonymous IMSIs. As this is a proof of concept, the code
to retrieve the next pseudonymous IMSI has no performance optimizations
and might not use a good entropy source (I did not verify).
Related: OS#4476
Change-Id: Ia93ee58d5e03c801eb774b9483a9a4417d031959
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 11 | ||||
-rw-r--r-- | tests/imsi_pseudo/imsi_pseudo.vty | 42 | ||||
-rw-r--r-- | tests/test_nodes.vty | 1 | ||||
-rw-r--r-- | tests/test_subscriber.vty | 3 |
4 files changed, 57 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 9015494..e3588ba 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -45,6 +45,7 @@ if ENABLE_EXT_TESTS python-tests: # don't run vty and ctrl tests concurrently so that the ports don't conflict $(MAKE) vty-test + $(MAKE) vty-test-imsi-pseudo $(MAKE) ctrl-test $(MAKE) db-upgrade-equivalence-test else @@ -68,6 +69,16 @@ vty-test: $(U) $(srcdir)/$(VTY_TEST) -rm -f $(VTY_TEST_DB) $(VTY_TEST_DB)-* +# IMSI pseudon VTY tests: don't share the DB with other VTY tests, so we can have deterministic "random" pseudo IMSIs +vty-test-imsi-pseudo: + -rm -f $(VTY_TEST_DB) + sqlite3 $(VTY_TEST_DB) < $(top_srcdir)/sql/hlr.sql + osmo_verify_transcript_vty.py -v \ + -n OsmoHLR -p 4258 \ + -r "$(top_builddir)/src/osmo-hlr -c $(top_srcdir)/doc/examples/osmo-hlr.cfg -l $(VTY_TEST_DB)" \ + $(U) $(srcdir)/imsi_pseudo/imsi_pseudo.vty + -rm -f $(VTY_TEST_DB) $(VTY_TEST_DB)-* + CTRL_TEST_DB = hlr_ctrl_test.db # To update the CTRL script from current application behavior, diff --git a/tests/imsi_pseudo/imsi_pseudo.vty b/tests/imsi_pseudo/imsi_pseudo.vty new file mode 100644 index 0000000..4709edb --- /dev/null +++ b/tests/imsi_pseudo/imsi_pseudo.vty @@ -0,0 +1,42 @@ +OsmoHLR> enable +OsmoHLR# subscriber imsi 111111111111111 create +... +OsmoHLR# subscriber id 1 update imsi-pseudo alloc +% New pseudonymous IMSI allocated: 111111111111111 +OsmoHLR# subscriber imsi 222222222222222 create +... +OsmoHLR# subscriber id 1 update imsi-pseudo alloc +% New pseudonymous IMSI allocated: 222222222222222 +OsmoHLR# subscriber id 1 update imsi-pseudo dealloc 111111111111111 +OsmoHLR# subscriber id 2 update imsi-pseudo alloc +% New pseudonymous IMSI allocated: 111111111111111 +OsmoHLR# subscriber imsi 333333333333333 create +... +OsmoHLR# subscriber id 1 update imsi-pseudo alloc +% New pseudonymous IMSI allocated: 333333333333333 +OsmoHLR# subscriber id 1 show + ID: 1 + IMSI: 111111111111111 + Pseudonymous IMSI (current): 333333333333333, i: 3 + Pseudonymous IMSI (previous): 222222222222222 + MSISDN: none +OsmoHLR# subscriber id 2 show + ID: 2 + IMSI: 222222222222222 + Pseudonymous IMSI (current): 111111111111111, i: 1 + MSISDN: none +OsmoHLR# subscriber id 3 show + ID: 3 + IMSI: 333333333333333 + MSISDN: none + +OsmoHLR# subscriber id 3 update imsi-pseudo alloc +% Error: all IMSIs are already allocated as pseudonymous IMSI + +OsmoHLR# subscriber id 1 update imsi-pseudo dealloc 123 +% Error: pseudonymous IMSI '123' is not allocated to given subscriber + +OsmoHLR# subscriber imsi 444444444444444 create +... +OsmoHLR# subscriber id 1 update imsi-pseudo alloc +% Error: subscriber already has two pseudonymous IMSI allocated diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty index 4995f85..7507c8f 100644 --- a/tests/test_nodes.vty +++ b/tests/test_nodes.vty @@ -93,6 +93,7 @@ log stderr logging level db notice logging level auc notice logging level ss info + logging level pseudo notice logging level mslookup notice logging level lu notice logging level dgsm notice diff --git a/tests/test_subscriber.vty b/tests/test_subscriber.vty index fb5da0e..a22641e 100644 --- a/tests/test_subscriber.vty +++ b/tests/test_subscriber.vty @@ -13,6 +13,8 @@ OsmoHLR# list subscriber (imsi|msisdn|id|imei) IDENT update aud3g milenage k K (op|opc) OP_C [ind-bitlen] [<0-28>] subscriber (imsi|msisdn|id|imei) IDENT update imei (none|IMEI) subscriber (imsi|msisdn|id|imei) IDENT update network-access-mode (none|cs|ps|cs+ps) + subscriber (imsi|msisdn|id|imei) IDENT update imsi-pseudo alloc + subscriber (imsi|msisdn|id|imei) IDENT update imsi-pseudo dealloc IMSI_PSEUDO show mslookup services OsmoHLR# subscriber? @@ -132,6 +134,7 @@ OsmoHLR# subscriber imsi 123456789023000 update ? aud3g Set UMTS authentication data (3G, and 2G with UMTS AKA) imei Set IMEI of the subscriber (normally populated from MSC, no need to set this manually) network-access-mode Set Network Access Mode (NAM) of the subscriber + imsi-pseudo Allocate or deallocate pseudonymous IMSI of the subscriber OsmoHLR# subscriber imsi 123456789023000 update msisdn ? none Remove MSISDN (phone number) |