Commit Graph

81 Commits

Author SHA1 Message Date
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 6072725622 pcu: Fix incorrect FN being send over PCUIF to PCU
The event FN contains the current FN, but the message should contain the
FN of the first burst of the block.

Change-Id: Iba0b1d1a3d7d875c5443a7bcaff399f9681624ad
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 d16bb27306 pcu: Handle PCUIF (DE)ACT.req messages
Change-Id: I4440a6b24fb76b4f8096706769250b91bd2444bb
2019-12-02 13:07:15 +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
Pau Espin 0361193a55 Update README.md of several TTCN3 test suites
Some stuff was wrong and some was missing after new features being
implemented in tests over time.

Change-Id: I7a279592a68ffc76408a8e728e76151534265cc0
2019-11-15 18:49:09 +00: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
Vadim Yanitskiy b58b7308e5 PCUIF_RAW_Components.ttcn: ClckGen_CT: fix PTCCH event handling
Both TDMA_EV_PTCCH_DL_BLOCK and TDMA_EV_PTCCH_UL_BURST events may
happen together during the same TDMA frame (fn % 104 == 90). We
shall not skip TDMA_EV_PTCCH_UL_BURST. Let's fix this.

Change-Id: Ifc66d5d1c5f9eaa7bed6882105298c45257ebef0
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
Vadim Yanitskiy 6edd4f5a06 library/GSM_RR_Types.ttcn: introduce generic tr_IMM_TBF_ASS
Both 't_IMM_ASS_TBF_DL' and 't_RR_IMM_ASS_TBF_DL' templates were
introduced for a specific task - matching Packet Immediate
Assignment (Downlink TBF) by TLLI.

In the upcoming changes we will also need to match Uplink TBF
assignment, and more generic fields such as Timing Advance.
Let's add a generic template for Packet Immediate Assignment
and allow passing IaRestOctets as a parameter.

Change-Id: I492cf990820ba153ea71469b8b623e56e031e549
2019-09-09 16:30:47 +02:00
Vadim Yanitskiy 7091e8de88 library/GSM_RR_Types.ttcn: refactor IaRestOctHH coding
According to 3GPP TS 44.018, section 10.5.2.16, IA Rest Octets IE
starting with 'HH' bits may contain one of the following CSN.1
encoded components:

  7 6 5 4 3 2 1 0  Bit Numbers
  H H 0 0 . . . .  Packet Uplink Assignment
  H H 0 1 . . . .  Packet Downlink Assignment
  H H 1 . . . . .  Second Part Packet Assignment

We already have (partial) support for the first two, while the
last type has not been supported so far. Let's add it.

Also, this change introduces several templates for IA Rest Octets
IE and some of its components mentioned above. This would allow
us to abstract the API users from dealing with further changes,
e.g. adding a coding attribute 'CSN.1 L/H' and missing fields.

Change-Id: Ib3a21e7c5fa1cad4466e3a09fa70540de7f6ecc5
2019-09-09 16:30:47 +02:00
Oliver Smith aac9b9ceca BSSGP_Emulation: add BssgpDecodeDepth
Make the decoding level (BSSGP, LLC, SNDCP, L3) configurable, so the
existing PCU tests, that expect messages only decoded to the BSSGP
level, can pass again. Move the SNDCP decoding in f_dec_bssgp above the
L3 decoding, so f_dec_bssgp goes through the layers in the reverse order
of f_send_bssgp_dec.

I have verified, that all testsuites using the BSSGP Emulation (SGSN,
PCU, PCU-SNS) are still working with this patch.

Related: OS#4180
Fixes: 955aa94504 ("BSSGP_Emulation: Abandon "BssgpDecoded" intermediate structure")
Change-Id: I8f76385528c1de98c557cee451c0e0dfd182b605
2019-09-02 09:15:33 +02:00
Oliver Smith aa6278dd8f pcu: add configs for running without docker
Base on docker-playground.git's ttcn3-pcu-test/*.cfg files, change IPs
to 127.0.0.1, log to stderr, adjust pcu-socket path.

Change-Id: Iff3e5e6cf0c608680c8c5f9f83e8bc1032274ea9
2019-08-30 13:21:54 +02:00
Oliver Smith 00d7bc4a93 pcu/GPRS_TBF.ttcn: less verbose logging
Reduce the formatted log size of TC_ul_tbf from ~140 MB to ~8 MB.

Related: OS#3925
Change-Id: Ibccfc399a6e8b50e4f01b5f167c47fbbde4533ed
2019-08-30 12:05:39 +02: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 3d1fd5feef PCU: make f_bssgp_establish() run on BSSGP_Client_CT
This means it can be used in different/other scenarios, e.g.
with tests that use PCUIF directly.

Change-Id: I1aa5dc090aac78a85a85ac190343befb0199a093
2019-03-27 11:17:49 +00:00
Harald Welte 797ab3a91c pcu: Fix MCC/MNC handling: use 'F' between MCC and MNC in 2-digit case
Change-Id: Ifdb64c501095839e86894716769adb53e3c17382
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 f12b5a412d pcu: Ensure we're always using the same defaults for the CGI
Not all parts of the code explicitly specify each and every parameter
of the Cell Gobal Identifier (particularly we don't do that for the PCU
INFO IND), and hence multiple parts only interoperate if the same
defaults are used in all locations.

Change-Id: Iac9be9a8d4ccb4d01cc343d763d2e35873e3844f
2019-03-27 11:17:49 +00:00
Harald Welte a419df22a6 PCU_Tests.ttcn: Use "normal" Osmocom TTCN-3 coding style
Change-Id: I6eaca0ec7fb9c2dc5d59e385bc3a3a8bb85fe23a
2019-03-27 11:17:49 +00:00