Commit Graph

48 Commits

Author SHA1 Message Date
Daniel Willmann 43a1a0be9e mgw: Don't try to send packets while MDCX is underway
TC_two_crcx_and_one_mdcx_rtp_ho sometimes failed while trying to send an
RTP packet without a connected port. f_flow_modify re-bind()s the port,
sends the MDCX and then connect()s it after the MDCX ACK returned the
IP/port combination.
If the transmit timer fires off between the bind and connect the
resulting send call will fail.

Change-Id: Idf93ceb830a44dafa56430ab5178f05da6bdd6fb
2018-08-01 17:55:54 +02:00
Philipp Maier 7df85f63bf MGCP_Test: Test what happens when two ends use different PT
It is legal that two connections use the same codec but negotiate
different dynamic payload types for both connections. Then the MGW is
expected to receive packets with one PT and send them with the other PT.
This is currently not done in osmo-mgw so the two tests that this commit
adds are expected to fail for now.

- add testcase TC_two_crcx_diff_pt_and_rtp
- add testcase TC_two_crcx_diff_pt_and_rtp_bidir

Change-Id: Ib4606dfc08764410ee9e450949361544adb07cd3
Related: OS#3384
2018-07-25 18:51:06 +00:00
Philipp Maier 3629139790 MGCP_Test: add function to check for RTP err counters
At the moment we check the error counters of the RTP statistics in
the testcases. However, in most situations we will do the check to
make sure that no errors occurred (all counters == 0). Rather than
having a long tail of if statements in the testcases we should have
a function for this. This also makes it much easier in case we add
more error countes lateron.

- add and use function f_rtpem_stats_err_check()

Change-Id: I69e5f80b0765284ec99056ce62c315461967d2a1
Related: OS#3384
2018-07-25 18:44:54 +00:00
Philipp Maier c290d7292e MGCP_Test: check payload type of received RTP packets
When an RTP packet is received, the payload type is not checked,
so we will not detect if the MGW emits packets with a wrong payload
type for some reason.

- Introduce a statistics counter that counts packets with wrong PT
- Update testcases so that they check for the statistics for wrong
  PT count.

Change-Id: I83d4b04656a16ced624024245a2fcb7a0ad48a8a
Related: OS#3384
2018-07-24 19:01:27 +02:00
Daniel Willmann afce86630c Stop tests after failures
Call mtc.stop after setverdict(fail), add reasons to most failures and
fail with verdict error for internal errors.

Change-Id: I9b618235939fa41160b9be6677b121963d3ec857
2018-07-24 14:19:42 +02:00
Philipp Maier 28bb82990c MGCP_Test: Make sure PT in RTP-Stream and MGCP match up
At the moment the RTP stream emulation is left in its default
configuration, this means that the payload type that appears in the RTP
stream is always 0. This may mismatch the payload type that is
configured with MGCP.

If nothing else is set, we should make sure that whan we create and modify
flows, the RTP emulation is always reconfigured to use the payload-type that
we set in the flow parameters. The other rtp-emulation parameters should
be set to their defaults.

- Make sure f_flow_modify and f_flow_create set the rtp flow parameters
  properly.

Change-Id: Ie888424ac3e0bf0d960b6f071855b6dd43935a0e
Related:OS#3384
2018-07-21 08:20:59 +00:00
Philipp Maier 4de3e377d1 MGCP_Test: do not use constant IP addresses
The RTP stream tests TC_two_crcx_and_unsolicited_rtp and
TC_two_crcx_and_one_mdcx_rtp_ho, which were introduced recently
with Change-Id I556a6efff0e74aab897bd8165200eec36e46629f, use
hardcoded ip addresses (127.0.0.1) to establish the RTP streams
that are used to test how the MGW reacts on unsolicited packets.
This works fine when everything runs on local host but on docker
it failes since the containers there have different ip-addresses.

- replace hardcoded IP-Addresses with modulepar variable in
  TC_two_crcx_and_unsolicited_rtp and TC_two_crcx_and_one_mdcx_rtp_ho

Change-Id: I5af5186f173c2b8564e8034249c82245acdd09f6
Related: OS#2703
2018-06-29 17:23:18 +02:00
Philipp Maier 2321ef92a3 MGCP_Test: add tests to verify actual RTP flows
The test coverage of the RTP aspects of the MGW is currently very
minima. Lets add a few more testcase to verify RTP behaves as
expected in various situations.

- Add testcase TC_one_crcx_receive_only_rtp:
  Test recvonly mode of the MGW. All packets must be absorbed by
  the MGW, no packets must come back.

- Add testcase TC_one_crcx_loopback_rtp:
  Test loopback mode of the MGW. All packet sent to the MGW must
  come back.

- Add testcase TC_two_crcx_and_rtp_bidir:
  We already test unidirectional transmissions. This test does
  the same as TC_two_crcx_and_rtp but for both directions.

- Add testcase TC_two_crcx_mdcx_and_rtp:
  Simulate a typical behaviour of a normal call. First create
  two half open connections and complete the connections later
  using MDCX.

- Add testcase TC_two_crcx_and_unsolicited_rtp:
  Test what happens when a RTP packets from rogue source are mixed
  into the RTP stream.

- Add testcase TC_two_crcx_and_one_mdcx_rtp_ho:
  Test a typical handover situation. An existing connection is
  handovered to another source on one end but the old source will
  keep transmitting for a while.

Change-Id: I556a6efff0e74aab897bd8165200eec36e46629f
Closes: OS#2703
2018-06-28 14:15:10 +02:00
Philipp Maier 76a8d0160e MGCP_Test: ts_CRCX_no_lco: check media description instead of media attribute
The testcase ts_CRCX_no_lco looks at the media attributes to see
if it findes the expected default codec there. In this testcase
we expect PCMU/8000/1 as media attribute, but this is a codec from
the fixed payload type domain. The MGW may not list this info inside
the media attributes. Listing the payload type number in the media
description is sufficient. We should check this instead.

- Remove media attribute check
- Check meida description for PCMU (0)

Change-Id: I69600a1025e68011e8fc5d8bf22d842d9c63bf53
Related: OS#2658
2018-06-23 11:40:04 +00:00
Philipp Maier 45635f4379 MGCP_Test: Test non LCO crcx
When a CRCX without an LCO option (codec) is sent, then older versions
of osmo-mgw will omit the port number in the SDP part of the response.
Also no default codec is selected and reported back. This testcase
pinpoints the problem.

Change-Id: Ie16cdab936ce468fe378d4ec9e1c61f81c07fb4e
Related: OS#2658
2018-06-06 17:16:21 +02:00
Harald Welte 9220f6336e Print more self-explanatory error message on bind/connect failures
When sockets cannot be bound or connected, the existing TTCN-3 code prints
the following rather cryptic error messages:

"IPA-CTRL-IPA(47)@f70ff1fd5cfd: Dynamic test case error: Using the value of an optional field containing omit. (Transport endpoint is not connected)"

The "Transport endpoint is not connected" sort-of gives it away, but
let's make it more explicit by introducing explicit checks for the
res.connId and manual setverdict(fail) statements with proper error
message.

Change-Id: Id22a1b5189d81c4fca03d5e7aff60ffdd1ad56bf
2018-05-23 20:27:02 +02:00
Harald Welte edc887435e mgw: Fix mixed-up MGW / local IP address
Change-Id: Ie4f6da896f53e9fabd7275fe6d8f8c6309e02d14
2018-03-29 18:01:51 +02:00
Harald Welte 935cb8f6ba mgw: Don't use RTP_Endpoint anymore. We use RTP_Emulation new.
Change-Id: I6302412daaafc37c8e7740cce4806405d3086fa7
2018-03-29 18:01:51 +02:00
Harald Welte bb7523b15b mgw: Add first tests for testing RTP streams
The existing MGW tests were entirely on the MGCP side.  Let's start
some tests that exchange RTP frames with the MGW and validate that
the MGW can actually act on what is configured via MGCP.

Change-Id: If620d5f8927d0e3584e90a7a8f785c6fdd7c2d17
2018-03-29 08:52:01 +02:00
Philipp Maier 8a3dc925da MGCP_Test: test illegal wildcarded DLCX and MDCX
- Add tests to check the behaviour on wildcarded DLCX and MDCX,
  both commands not supported by the MGW and should fail.

Change-Id: I140c6d9e337cd16d6147bb582a9474cf76b5170b
2018-02-02 16:14:37 +01:00
Philipp Maier dffa6a46e6 MGCP_Test: Clean up after TC_crcx_sdp
The testcase TC_crcx_sdp does not clean up the connection it
created. This can cause subsequent tests to fail.

- Use f_dlcx_ok() to clean up the connection once the test
  is done.

Change-Id: I4e0f5ce218fadc5debe0bbf548b69919584ab66c
2018-02-02 16:14:37 +01:00
Philipp Maier 5e06ceefbe MCGP_Test: Add tests for wildcarded CRCX
The wildcarded CRCX is not tested yet.

- Add a test function that executes a single wildcarded CRCX
  request

- Add a test function that exchausts all MGW resources using
  wildcarded CRCX requests

Change-Id: I70cf486dc21aef19e4199289f5a5509f6927713e
2018-02-02 16:14:37 +01:00
Philipp Maier bb7a01c696 mgw: add constants for mgw endpoint and domain name
The testcase for osmo-mgw hardcodes the mgw domain and also lacks
an endpoint identifier, which was deprecated recently.

- replace the hardcoded occurrences of the mgw domain name with
  a constant

- add a constant for the rtpbridge endpoint identifier

- add a testcase that still uses the old method without prefix
  on the endpoint identifier.

Change-Id: If4455c4cb521270b2fe24881ade9b578a5132205
2018-02-02 16:14:28 +01:00
Harald Welte f91edf3b49 MGCP_Test: be more liberal in some of the error codes we expect
Sometimes it's not entirely clear which error code should be returned,
so let's accept multiple options, depending on the situation

Change-Id: I6d6eaec4d025b9da170f59c759884afe2e768521
2017-12-28 14:21:03 +01:00
Harald Welte 33d8216ab4 MGCP: Add 30 endpoint number test to control section
Change-Id: Ifa03697531680c72e4179a4195aeac371660b722
2017-12-28 14:20:53 +01:00
Harald Welte 646ecdb8e4 MGCP_Test: Test use of 30 endpoint numbers
We used to have a big (OS#2784) where only endpoint numbers below
10 (0x0A) were working due to failed interpretation in hex/dec.

Let's use up to 30 endpoints to ensure hex as well as two-digit
digit numbers.

Change-Id: Ifb3e01b5d31decefbf0c87ea39ec5021c8795579
2017-12-28 03:28:40 +01:00
Harald Welte 4029e8cd03 Move MGCP_Types.ttcn to library; extract MGCP_Templates.ttcn to library 2017-11-24 20:52:06 +01:00
Harald Welte 34ca5b4796 mgw: Fix SDP transport string "RTP/AVP" (one surplus "A" removed) 2017-11-18 22:15:10 +01:00
Harald Welte 2bcfd3a00b mgw: Include mandatory connection-id in MDCX 2017-11-18 22:14:35 +01:00
Harald Welte 5e5cce533a mgw: Add missing audio codec specification "a:PCMU"
Let's make sure we request a reasonable audio codec in the
LocalConnectionOptions
2017-11-18 22:14:08 +01:00
Harald Welte e0b331fa69 mgw: update comment to reflect implemented tests 2017-11-18 20:35:40 +01:00
Harald Welte 8d2fbb4d61 mgw: Move f_mgcp_par_append() to top of file 2017-11-18 20:34:21 +01:00
Harald Welte 0d19861719 mgw: Check for 535 in case of invalid packetization period 2017-11-18 19:58:31 +01:00
Harald Welte f53f1647bc mgw: Test for duplicate transmission of DLCX 2017-11-18 19:57:11 +01:00
Harald Welte 6d167f8472 mgw: Add test cases for invalid DLCX commands 2017-11-18 19:41:35 +01:00
Harald Welte 10889c1d13 mgw: generalize f_dlcx versions, avoiding copy+paste 2017-11-18 19:40:31 +01:00
Harald Welte 79181ffc8b mgw: Test DLCX in three diffeent (valid) configurations
DLCX can be with EP-only, with EP+CallId or with EP+CallId+ConnId,
let's test all three valid cases.
2017-11-18 19:26:25 +01:00
Harald Welte 9988d28228 mgw: Avoid copy+paste of CRCX_ACK template 2017-11-18 19:22:00 +01:00
Harald Welte edc45c19fd mgw: Delete all connections of EP before starting a test case
as part of f_init() we now issue an endpoint-wide DLCX without
call-id or connection-id.  This means that the endpoint should be
in a pristine state after f_init() returns.
2017-11-18 19:15:05 +01:00
Harald Welte c40e0c3cbd mgw: make f_dlcx_{ok,ignore}() support EP, EP+call_id or EP+call_id+conn_id
A MGCP DLCX can contain either only the EP, or EP+call_id or
EP+call_id+conn_id in order to specify what shall be deleted.  Let's
structure ts_DLCX() and the f_dlcx_{ok,ignore}() function in a way to
support this in an intuitive way.
2017-11-18 19:08:22 +01:00
Harald Welte a01e38d371 mgw: Handle MgcpParameterList more elegantly, less repetition 2017-11-18 18:40:01 +01:00
Harald Welte ba62c8c95b mgw: properly clean up endpoint by use of DLCX at end of each testcase 2017-11-18 18:27:01 +01:00
Harald Welte f07c286a55 mgw: Add sockets for RTP packets + code for bind/connect/send RTP 2017-11-18 17:19:21 +01:00
Harald Welte 5501536e81 mgw: Prepare for RTP support: Prefix ambiguous functions/variable names 2017-11-18 16:02:42 +01:00
Harald Welte cbae9d109f Fix TC_crcx_and_dlcx(): Don't assume DLCX returnsConncetionID 2017-11-17 23:25:26 +01:00
Harald Welte 6f960b1bd6 mgw: Ensure that CRCX succeeds only if ConnectionId is present in response 2017-11-17 23:24:46 +01:00
Harald Welte 21ba5574f9 MGCP_Test: Add comments throughout the code to help readability 2017-09-19 17:55:05 +08:00
Harald Welte 5b4c44ec5a MGCP: Test for CRCX followed by DLCX 2017-09-17 16:35:27 +08:00
Harald Welte e636afd5d1 MGCP: Extend tests significantly
We're now testing a variety of different permitted and illegal
transactions of the MGW.  Still lots of bits pending, particularly
also actual RTP flows.
2017-09-17 16:24:09 +08:00
Harald Welte e1e18c5e33 MGCP: introduce global variable + accessor function for transaction ID 2017-09-17 16:23:07 +08:00
Harald Welte 3c6ebb9c93 MGCP_Test: Some templates to encode MGCP messages 2017-09-16 09:37:28 +08:00
Harald Welte 2871d0b000 mgw: Add missing mandatory "s=" to SDP of c_mdcx4 2017-09-14 22:42:12 +08:00
Harald Welte 00a067f54d Add minimal MGCP parser/encoder based on TEXT codec 2017-09-13 23:27:17 +02:00