Commit Graph

49 Commits

Author SHA1 Message Date
Vadim Yanitskiy 98bb2d5eea library/GSM_RR_Types: do not duplicate Mobile Identity records
All the records related to Mobile Identity IE (see 3GPP TS 24.008,
section 10.5.1.4) are defined in [1], so there is no real need to
dumplicate them. Moreover, most of the related templates in
library/L3_Templates.ttcn are based on these records.

[1] titan.ProtocolModules.MobileL3_v13.4.0/src/MobileL3_CommonIE_Types.ttcn

Change-Id: I27c2743c59db770d6f7e9447dc8c1f539b228ced
2020-03-28 03:29:22 +07:00
Vadim Yanitskiy 7b2242157b PCU: also test GSGN originated PS/CS Paging containing TMSI
This additional couple of test cases reveals several bugs:

  1) the IUT encodes a erroneous RR Paging Request message
     containing P-TMSI, so TITAN fails to decode it;

  2) the IUT prints an invalid P-TMSI in its log output
     due to load of misaligned address (found by UBSan).

[1] I97fd5ffc15a4a58112d7c37c69b7ac42b0741a0e
[2] Icf8836f216793e342b239c8e6645aac1e82bf324

Change-Id: I7fbec5b2c5c3943a7413417b623f55c135c152d7
2020-03-26 16:27:50 +07:00
Vadim Yanitskiy cca15a388f pcu: cosmetic: fix formatting of 'execute' statements
Change-Id: Ia5a0eca1be13cc6580329b272ed9f663938f1e60
2020-03-24 21:27:00 +07:00
Pau Espin dc9666ff9c pcu: Verify CodingScheme of received data blocks
Change-Id: I0a5247650548f8a03f7b025aae65652fb424c156
2020-03-20 20:03:59 +01:00
Pau Espin 2422d1fa82 pcu: Introduce TC_mt_ping_pong_with_dl_racap
Allows checking how pcu parses MS RA Capabilities coming from SGSN.

Change-Id: Iedd8ab278547471b72252743d93a0f9e11d7e787
2020-03-18 15:53:17 +01:00
Pau Espin e7cabe6f54 pcu: Introduce TC_mt_ping_pong
Change-Id: I0cbf4ac78e4c89f21b8c2b92eba1783667501e64
2020-03-18 13:27:45 +01:00
Pau Espin 925818ac36 pcu: Check received IMSI suffix from PCUIF paging request
Change-Id: Ia11447fb71ea0b6a8fcce1a28e93cc166d22ef7a
2020-01-11 00:24:03 +00:00
Vadim Yanitskiy 322c79367b PCU: fix: actually match IMSI in Packet Paging Request
Change-Id: I0afdd53fd5d2a89e139f65a7aec412a2e12511cc
2020-01-03 22:20:50 +00:00
Vadim Yanitskiy 5e51873d9c library/RLCMAC_CSN1_Types.ttcn: fix ps / cs selection in PageInfo union
Change-Id: I40c2a3c38799a625836e4c28f476524c92077b83
2020-01-03 22:20:50 +00:00
Pau Espin 4536c82b99 pcu: Move NS tests to PCU_Tests_RAW_NS.ttcn
Tests from PCU_Tests_RAW_SNS inherit most infrastructure from NS tests
defined in PCU_Tests_RAW, which in turn don't share that much with other
tests present in that file. This way we simplify file PCU_Tests_RAW.ttcn,
which will potentially grow once more tests are added.

Change-Id: If680d1bd7dbfe98829f330c33705e0f13bedf3c7
2019-12-30 14:06:06 +01:00
Pau Espin f04ba541c1 pcu: Pass correct fn to ts_PCUIF_DATA_CNF
Change-Id: I68fc0e3dba2cdadbe479017f31868f6dd0dabe9f
2019-12-23 14:47:44 +01:00
Pau Espin 88bf537b35 pcu: Introduce tests for CS and PS paging from SGSN/Gb
CS Gb paging and PTP CS/PS paging implemented in osmo-pcu:
I9501e02e1d7f6944497e724dbccb9a19c3f5221f
I5c52b5af740460c48bb3ba858243b1d20e624268

Related: OS#3927, OS#2406
Change-Id: I90b5a792c1d91e38ea7b8c060ff0b459673df951
2019-12-23 14:46:07 +01:00
Oliver Smith 8f9daab414 pcu: add TC_paging_cs_from_bts
1. BTS send a CS paging Request over pcu socket
2. Expect a CS paging frame

Related: OS#3927
Change-Id: Ia3ad503c243c9b3b162e204683fa4fa5447bbab3
2019-12-17 13:53:44 +00:00
Pau Espin ff8da1901b pcu: Introduce test TC_t3193
Change-Id: Ib11cd1793d985ff609b10b0e60bddadd5fcfa6d2
2019-12-17 13:53:44 +00:00
Pau Espin a7b7566e0b pcu: Introduce test TC_imm_ass_dl_block_retrans
Change-Id: Icc60cebb8583c9dc97b658def69f17e6efced384
2019-12-17 13:53:44 +00:00
Pau Espin 8948633e8c pcu: Introduce helpers to update AckNackDescription
Change-Id: Ic62ab9e4a854239b95c434068543d95c5352f1c6
2019-12-17 13:53:44 +00:00
Pau Espin 7503c872db pcu: send UL CONTROL ACK triggered by DL ACK/NACK
Change-Id: Ib409394257427cfc62da08fe06ce6c001dcf608a
2019-12-17 13:53:44 +00:00
Pau Espin 65bab9e3bc pcu: Support sending message to PCU at specific FN
Change-Id: I81a29b4885f3fc6b753a1612d5fd369cd18f5dc6
2019-12-06 09:51:31 +00:00
Pau Espin 6e3b68988a pcu: Verify contents of data dl blocks originated from emulated SGSN
Change-Id: I4fe79572094038cbb26d5195c0544846ca2550b5
2019-12-06 09:51:31 +00:00
Pau Espin a3f0a85eb2 pcu: TC_mo_ping_pong: Check DL block is sent and ACK it
Function f_rx_rlcmac_dl_block_exp_data() still misses proper
verification of data. Apparently the received message has 2 blocks,
first with expected 10 bytes, but next one contains 18 bytes with 4
actual bytes and other bits are padding.

Last DL ACK/NACK sent is not yet working correctly. osmo-pcu seems to be
unable to match it against sent DL block (I think due to non-matching
FN), and instead drops it and schedules after timeout an IMM ASS to try
to send DL block again.

Change-Id: Icf66dd5c07690368722c586632c38fb7e770053c
2019-12-04 16:33:31 +00:00
Pau Espin 216596340a pcu: Fix RLCMAC template naming
There's also DL_ACK_NACK message for which a template will be introduced
soon, so let's rename and fix typos/wrong descriptions to avoid
confusion later.

Change-Id: I4a2025ad282006953fcfadf429c980b77cb94371
2019-12-02 19:12:10 +01:00
Pau Espin 3eef95c031 pcu: Introduce tests to check UL CS initial and max
Related: OS#4286
Change-Id: I3aa654e6f678698e5b8cb4914f1ca5b39fc08568
2019-12-02 11:14:49 +00:00
Pau Espin 2a45a5037d pcu: Add VTY support and use it to set (M)CS lqual thresholds
Requires osmo-pcu.git I3430abb5fc622dec293457466e760de95fa3a05c, before
that commit OsmoPCU cmd prompt contained a dash which resulted in TTCN3
being unable to match it.

Change-Id: I221675721b65b3ab44179e9657da70ba4004d7de
2019-12-02 11:14:49 +00:00
Pau Espin 1755fab662 pcu: Introduce test TC_mo_ping_pong
Ideally some more checks should be done on this test at the end, but
it's fine keeping it as it is for now and can be extended later.

Change-Id: I3be5123ff5294e5851652ec14d54589442082b28
2019-11-23 08:10:19 +00:00
Vadim Yanitskiy 36558d9526 library/PCUIF_Types.ttcn: extend RACH.ind with TRX / TS number fields
Since there can be multiple PDCH channels configured on different
timeslots, different TRXes, and BTSes, the PTCCH/U handling code
in OsmoPCU needs to know the exact origin of a given RACH.ind.

Otherwise, it is not known which subscriber originated a given
PTCCH/U indication, and hence it is impossible to send PTCCH/D
Timing Advance notification properly.

Fortunately, we can extend the RACH.ind message without even
bumping the protocol version, because every single PDU has a
fixed size defined by the largest message - INFO.ind. In case
if the actual message payload is smaller, the rest is filled
with a constant padding byte (0x00).

Older versions of OsmoPCU will consider the new fields as padding,
while the messages from older OsmoBTS versions will always have
both fields set to 0x00. Since C0/TS0 cannot be configured to
PDCH, this can be easily detected on the other end.

Change-Id: Ia5c4e504a21dc5508920553d3856027455dba1b1
Related: OS#4102, OS#1545
2019-11-23 07:57:45 +00:00
Vadim Yanitskiy 26cd244a9f PCU_Tests_RAW.ttcn: fix the expectations of TC_cs_lqual_ul_tbf
As it turned out, OsmoPCU is not supposed to change the Coding
Scheme immediately when the recent link quality value leaves the
current window. Instead, in order to avoid rapid changes of the
Coding Scheme, it also takes the previous value into account.
Thus the current Coding Scheme is only changed if both current
and old values fit into a new window.

This change makes the test case pass.

Change-Id: I5d503d5a9c46cb9de84fbabd2d591afbe4216fdb
2019-11-17 02:06:19 +07:00
Vadim Yanitskiy 20f8700767 PCU_Tests_RAW.ttcn: fix ToA handling in as_ta_ptcch()
As it turns out, it was a bad idea to use a counter in altstep
as_ta_ptcch(), because its value is getting lost. Let's instead
introduce a new type PTCCH_TAI_ToA_MAP, which is basically a
list of ToA values for each PTCCH/U sub-slot (TA Index), and
pass it to the altstep.

Change-Id: I74252dfb929fcb32d07e8728d692674931fae727
2019-10-09 15:24:22 +00:00
Pau Espin cf47a920e5 pcu: TC_t3169: Check ul block reaches SGSN before timer expiration
Change-Id: Ic6fd82dc5037d08278d36aed9b6e72e80da5c42f
2019-10-07 15:28:22 +02:00
Pau Espin 596faa40dc pcu: Introduce test TC_t3169
Related: OS#3928
Change-Id: I587413a7de7956daee3423057530e4052a55ba88
2019-10-07 13:27:25 +02:00
Pau Espin 6c1b4be6c3 pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()
Change-Id: I5b8a7ca5a4d0f905bf68949978811b139568c237
2019-10-07 13:23:54 +02:00
Pau Espin f787b0953c pcu: Allow tests to overwrite pcuif INFO_IND params
Change-Id: I75c746b822184fdcc966d77a7c6a0a6918c236e6
2019-10-07 13:23:51 +02:00
Pau Espin c3a7732311 pcu: Introduce some function helpers
Change-Id: I8608fac4375153d5020df5d05026513a7fe931d6
2019-10-07 11:21:25 +02:00
Vadim Yanitskiy 02f77d8807 PCU_Tests_RAW.ttcn: add a test case for continuous Timing Advance control
Unlike the circuit-switched domain, Uplink transmissions on PDCH time-slots
are not continuous and there can be long time gaps between them. This happens
due to a bursty nature of packet data. The actual Timing Advance of a MS may
significantly change between such rare Uplink transmissions, so GPRS introduces
additional mechanisms to control Timing Advance, and thus reduce interference
between neighboring TDMA time-slots.

At the moment of Uplink TBF establishment, initial Timing Advance is measured
from ToA (Timing of Arrival) of an Access Burst. This is covered by another
test case - TC_ta_rach_imm_ass. In response to that Access Burst the network
sends Immediate Assignment on AGCH, which _may_ contain Timing Advance Index
among with the initial Timing Advance value. And here PTCCH comes to play.

PTCCH is a unidirectional channel on which the network can instruct a sub-set
of 16 MS (whether TBFs are active or not) to adjust their Timing Advance
continuously. To ensure continuous measurements of the signal propagation
delay, the MSs shall transmit Access Bursts on Uplink (PTCCH/U) on sub-slots
defined by an assigned Timing Advance Index (see 3GPP TS 45.002).

The purpose of this test case is to verify the assignment of Timing Advance
Index, and the process of Timing Advance notification on PTCCH/D. The MTC
first establishes several Uplink TBFs, but does not transmit any Uplink
blocks on them. During 4 TDMA multi-frame periods the MTC is sending RACH
indications to the PCU, checking the correctness of two received PTCCH/D
messages (period of PTCCH/D is two multi-frames).

At the moment of writing, PTCCH handling is not implemented in OsmoPCU
(neither PTCCH/D messages are correct, nor PTCCH/U bursts are handled).

Additionally, this change introduces a new message type, which is used
for sending commands to the RAW components - RAW_PCU_Command. Commands
can be used to (re)configure components at run-time.

Change-Id: I868f78e3e95a95f8f2e55e237eea700d7d4726a3
Related: SYS#4606
2019-10-04 20:24:08 +07:00
Vadim Yanitskiy 1f72b0ad84 PCU_Tests_RAW.ttcn: introduce a test case for PTCCH/D coding
Change-Id: I887c8922446d0c1a959e6f2678f50e5754f55e83
Related: SYS#4606
2019-10-01 05:59:00 +07:00
Vadim Yanitskiy 6276b6cf52 PCU_Tests_RAW.ttcn: TC_cs_lqual_ul_tbf: properly check for Dynamic Assignment
According to 3GPP TS 44.018, section 10.5.2.16 "IA Rest Octets",
Packet Uplink Assignment can be either of the following types:

  - single block allocation,
  - dynamic allocation.

The current version of TC_cs_lqual_ul_tbf does not handle single
block allocation, so we need to make sure we got a TBF with
dynamic allocation.

Change-Id: I05cf0c62d21094fb53a9e5e54b404f3cf972a182
2019-09-29 20:11:22 +07:00
Vadim Yanitskiy 740ae7614c PCU_Tests_RAW.ttcn: refactor TC_pcuif_suspend: use the RAW PCU components
This change is a step towards getting rid of the old test case
infrastructure. Note that a call to f_bssgp_establish() is moved
out of f_init_bssgp() to the test case's body.

Change-Id: If15339f02c5188e60fcb47ae6dc0ac289efa2896
2019-09-29 16:19:36 +07:00
Vadim Yanitskiy 0eb26621d8 PCU_Tests_RAW.ttcn: add test case for UL link quality adaptation
This change introduces a new test case TC_cs_lqual_ul_tbf, which
is aimed to test the feedback of OsmoPCU on changing link quality
measurements in Uplink Data blocks during an active TBF.

Change-Id: Ia78d93e43a3c41b0b30e70df20a2da31077fd05f
Related: SYS#4607
2019-09-27 03:17:50 +00:00
Vadim Yanitskiy 3e1d31808e PCU_Tests_RAW.ttcn: introduce TC_ta_rach_imm_ass to test initial TA
The aim of this test case is to test the correctness of Timing Advance
at the time of TBF establishment. In particular, the test case sends
several Access Bursts (RACH.ind) with increasing 'qta' value, what
causes OsmoPCU to allocate a TBF (Temporary Block Flow) for each
RACH.ind and send DATA.req with Immediate Assignment on AGCH,
containing the expected Timing Advance value.

Change-Id: I21f76ae723519c0eb54515922a05ca8045b00ade
Related: SYS#4606
2019-09-27 03:17:50 +00:00
Vadim Yanitskiy f7d9c0f22b Introduce PCUIF, BTS and ClckGen components for RAW PCU test cases
The problem of existing test cases is that they mix IUT (i.e. OsmoPCU)
with OsmoBTS (osmo-bts-virtual) and OsmocomBB (virt_phy). This approach
allows to avoid dealing with TDMA clock indications and RTS requests on
the PCU interface - this is done by OsmoBTS. On the other hand, our test
scenarios may be potentially affected by undiscovered bugs in OsmoBTS
and the virt_phy.

In order to solve that problem, this change introduces a set of new
components and the corresponding handler functions:

  - RAW_PCUIF_CT / f_PCUIF_CT_handler() - PCU interface (UNIX domain socket)
    handler. Creates a server listening for incoming connections on a given
    'pcu_sock_path', handles connection establishment and message forwarding
    between connected BTS components (see below) and OsmoPCU.

  - RAW_PCU_BTS_CT / f_BTS_CT_handler() - represents a single BTS entity,
    connected to OsmoPCU through the RAW_PCUIF_CT. Takes care about sending
    System Information 13 to OsmoPCU, forwarding TDMA clock indications from
    a dedicated ClckGen component (see below), and filtering the received
    messages by the BTS number. Implements minimalistic scheduler for both
    DATA.ind and RTS.req messages, so they are send in accordance with the
    current TDMA frame number.

  - RAW_PCU_ClckGen_CT / f_ClckGen_CT_handler() - TDMA frame clock counter
    built on top of a timer. Sends clock indications to the BTS component.

All components communicate using TTCN-3 ports and explicitly defined sets
of messages (see RAW_PCU_MSG_PT). One noticeable kind of such messages is
events (see RAW_PCU_Event and RAW_PCU_EventType). That's how e.g. the PCUIF
component can notify the BTS component that OsmoPCU has just connected, or
the BTS component can notify the MTC that SI13 negotiation is completed.
Events may optionally have parameters (e.g. frame-number for TDMA_EV_*).

Furthermore, the proposed set of components allows to have more than one
BTS entity, so we can also test multi-BTS operation in the future.

  +-----+               +----------+      +---------+
  | MTC +---------------+ PCUIF_CT +------+ OsmoPCU |
  +--+--+               +----+-----+      +---------+
     |                       |
     |                       |
     |                       |
     |    +-----------+      |      +---------------+
     +----+ BTS_CT #1 +------+      | ClckGen_CT #1 |
     |    +-----+-----+      |      +-------+-------+
     |          |            |              |
     |          +---------------------------+
     |                       |
     |    +-----------+      |      +---------------+
     +----+ BTS_CT #2 +------+      | ClckGen_CT #2 |
     |    +-----+-----+      |      +-------+-------+
     |          |            |              |
     |          +---------------------------+
     |                       |
     |    +-----------+      |      +---------------+
     +----+ BTS_CT #N +------+      | ClckGen_CT #N |
          +-----+-----+             +-------+-------+
                |                           |
                +---------------------------+

Change-Id: I63a23abebab88fd5318eb4d907d6028e7c38e9a3
2019-09-27 03:17:50 +00:00
Harald Welte 955aa94504 BSSGP_Emulation: Abandon "BssgpDecoded" intermediate structure
It originally seemed like a great idea to define a custom record
which aggregates the decoded BSSGP, LLC, L3 and/or SNDCP and passes
it to the individual ConnHdlr.  However, particularly with testcase
interoperability for IuPS in mind, this seems bogus.  Also, we
never really took advantage of this.

Let's now decode as far as we can decode any PDU, and then send the
decoded version of that PDU via the ports between the BSSGP_Emulation
and the ConnHdlr component.

Change-Id: I8c1082880902dd9a04935945f0293895f4d0c53a
2019-08-18 17:12:46 +00:00
Harald Welte 34b5a95d09 cosmetic: Update copyright statement, license notice and SPDX
Some of our files didn't have a copyright notice at all, let's add
it.  Also, update the notices in other files and ensure a SPDX
identifier is present in all but the most trivial files.

Change-Id: If7fa19ce484b415bc645e39b3d0d666b44b5f0fd
2019-05-27 10:00:06 +00:00
Harald Welte 7fd25cfbfd pcu: Add TC_pcuif_suspend() to test PCU->BSSGP SUSPEND processing
The PCU is supposed to forward any RR SUSPEND received by the BTS
on dedicated channels and pass it to the SGSN via BSSGP.  This provides
knowledge to the SGSN that the MS is not reachable via PS/TBF anymore
until it completes its CC dedicated mode transaction and RESUMEs.

Change-Id: Iaf35e0c1087413db1dc7d169fa716df14c78f5db
2019-03-27 11:17:49 +00:00
Harald Welte 0466d16d42 pcu: move f_pcuif_tx() to PCU_Tests_RAW as it runs on RAW_PCU_CT
Change-Id: Ic60a7fc657df17ff2d3a889501f0576b98f1f4ad
2019-03-27 11:17:49 +00:00
Harald Welte 64d0731c5b pcu: Add SNS tests for SGSN-originated BVC-RESET handling
Change-Id: Ib6b80acf98711f4749da4faf549b02ff2b82425f
2019-03-20 10:57:38 +00:00
Harald Welte ecd159ecc7 pcu: Test SNS where initial IP/port is not part of configured NS-VCs
As per section 6.2.1 of 3GPP TS 48.016, the initial IP/port where the
SNS SIZE/CONFIG procedures are being performed is not automatically part
of the later NS-VCs.  This means we shall not perform the NS-ALIVE
procedure or any other procedure beyond SNS with that specific endpoint.

This adds a new TC_sns_1c1u_separate() to test for this behavior.

Change-Id: Ie2a017250ca1d5386e2cf42d1945e61d170ac92d
Related: OS#3844
2019-03-16 14:46:12 +01:00
Harald Welte ea3c7e945e PCU: Split RAW_PCU_CT from RAW_NS_CT
Let's split the PCUIF-side component from the NS-side component
and create a new RAW_Test_CT which derives from both.

Change-Id: I15021c5dea16e39a530d8d9080e37a7f2a6c4fa7
2019-03-02 00:04:52 +01:00
Harald Welte bf76824482 PCU: Prepare for having multiple Gb connections on tester side
Change-Id: I6de4832bda18b36873f57986a34ba8082af2c853
Related: OS#3372
2019-02-26 10:20:29 +00:00
Harald Welte c4d7beb3ff PCU: Move SNS specific functions to PCU_Tests_RAW_SNS.ttcn
Change-Id: Ie41a21b6f2b95f4aaea84d8b717e96efefb704e3
RelateD: OS#3372
2019-02-26 10:20:29 +00:00
Harald Welte 9fbcf4b01e PCU: Tests for the BSS/PCU side NS/BSSGP implementations
The existing (unused) PCU_Tests are operating on top of a NS + BSSGP
emulation, i.e. they're aimed at testing higher protocol layers.  Also,
they required BTS+BSC to run next to the PCU.

The new PCU_Tests_RAW introduced in this patch are the exact opposite:
* they test the PCU alone (attach to PCUIF and Gb interface)
* they don't require BTS or BSC to run
* they don't use NS + BSSGP emulation but raw NS/BSSGP frames to
  test the very NS/BSSGP implementation inside of OsmoPCU.

Change-Id: I7ad76b96974cf0a686ad0f00ccd09d1a9df8b4d5
Related: OS#2890
2019-02-21 11:53:42 +01:00