diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-11-24 23:34:42 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-11-24 23:38:17 +0100 |
commit | 4aa47e87b7253330e5887af123deb13da0ff3948 (patch) | |
tree | 0bccddf76876d476c786fab90b459a6992a1f5ce | |
parent | c5a334ef8bb42b2918d852a7c776e6a866a65b17 (diff) |
fakebts: Make it easy to do a LU and get the current TMSI from it
Tests that require sending a CM Service Request require a TMSI. Add
a selector that helps to get the TMSI so it can be used in tests.
-rw-r--r-- | fakebts/OpenBSCTest.st | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/fakebts/OpenBSCTest.st b/fakebts/OpenBSCTest.st index faed987..bde16fe 100644 --- a/fakebts/OpenBSCTest.st +++ b/fakebts/OpenBSCTest.st @@ -97,6 +97,7 @@ Object subclass: OpenBSCTest [ | bts testFailed | <category: 'OpenBSC-Test'> <comment: 'I help in dealing with setup and teardown of a test'> + <import: OsmoGSM> OpenBSCTest class >> initWith: aBTS [ <category: 'creation'> @@ -176,5 +177,56 @@ Object subclass: OpenBSCTest [ <category: 'verifying'> ^ testFailed ] + + allocateTmsi: imsi [ + | tmsi lchan lu msg | + "Do a LU and get the TMSI." + "2. Get a LCHAN" + lchan := self requireAnyChannel. + + "3. Send the LU request" + lu := GSM48LURequest new. + lu lai + mcc: 1; + mnc: 1; + lac: 1. + lu mi imsi: imsi. + lchan sendGSM: lu toMessage. + + "Now deal with what the NITB wants" + "4.1 Send the IMEI..." + msg := GSM48MSG decode: lchan nextSapi0Msg readStream. + (msg isKindOf: GSM48IdentityReq) + ifFalse: [^self error: 'Wanted identity request']. + (msg idType isIMEI) + ifFalse: [^self error: 'Wanted IMEI reqest']. + msg := GSM48IdentityResponse new. + msg mi imei: '6666666666666666'. + lchan sendGSM: msg toMessage. + + "4.2 LU Accept" + msg := GSM48MSG decode: lchan nextSapi0Msg readStream. + (msg isKindOf: GSM48LUAccept) + ifFalse: [^self error: 'LU failed']. + tmsi := msg mi tmsi. + msg := GSM48TMSIReallocationComplete new. + lchan sendGSM: msg toMessage. + + "4.3 MM Information for the time. ignore it" + msg := GSM48MSG decode: lchan nextSapi0Msg readStream. + (msg isKindOf: GSM48MMInformation) + ifFalse: [^self error: 'MM Information']. + + "4.4 release.. if we now don't close the LCHAN it will + remain open for a bit. OpenBSC should and will start the + approriate timer soon(tm)" + msg := GSM48MSG decode: lchan nextSapi0Msg readStream. + (msg isKindOf: GSM48RRChannelRelease) + ifFalse: [^self error: 'RR Channel Release']. + + "4.5.. be nice... for now and send a disconnect." + lchan releaseAllSapis. + ^ tmsi. + ] ] |