Feature #4343
closedtest SCCP inactivity timers
100%
Description
I think we don't currently have tests for the SCCP Inactivity timers (See Section 3.4 of ITU-T Q.714).
We should test both Tias and Tiar as follows:- Verify that on an otherwise idle SCCP connection, the libosmo-sccp stack generates an IT message at every Tias expiration
- Verify that on an otherwise idle SCCP connection, we don't timeout after Tiar expires if we receive an incoming message (such as IT) before Tiar expires.
- Verify that on an otherwise idle SCCP connection, we do timeout after Tiar expires if we don't receive an incoming message (such as IT) before Tiar expires.
To avoid very long test execution times, we may use VTY commands to reduce the timeouts.
Related: SYS#4761
ITU-T Q7.13 section "4.17 Inactivity test (IT)": https://www.itu.int/rec/T-REC-Q.713/en/
ITU-T Q.714 section "3.4 Inactivity control": https://www.itu.int/rec/T-REC-Q.714-200105-I/en
https://tools.ietf.org/html/rfc3868#section-3.3.11
Related issues
Updated by pespin over 4 years ago
Related content from specs:
CC message received -> The inactivity control timers, T(ias) and T(iar), are started. N-DISCONNECT request or connection release sent -> The inactivity control timers, T(ias) and T(iar), if still running, are stopped. RLSD message is received -> The inactivity control timers, T(ias) and T(iar), if still running, are stopped. 3.4 Inactivity control When any message is sent on a connection section, the send inactivity control timer is reset. When any message is received on a connection section, the receive inactivity control timer is reset. When the send inactivity timer, T(ias), expires, an IT message is sent on the connection section. The receiving SCCP checks the information contained in the IT message against the information held locally. If a discrepancy is detected, then the following actions (Table 3) are taken: Table 3/Q.714 Discrepancy Action Source reference number Release connection Protocol class Release connection Sequencing/segmenting (Note) Reset connection Credit (Note) Reset connection NOTE – Does not apply to class 2 connection. When the receive inactivity control timer, T(iar), expires, the connection release procedure is initiated on a temporary connection section and OMAP is informed for a permanent connection section. Timers T(ias) Delay to send a message on a conn IT on a connection section when there are no messages to send => 5 to 10 minutes T(iar) Waiting to receive a message on a connection section => 11 to 21 minutesRelated VTY commands (libosmo-sccp):
- "sccp-timer iar <seconds>" (OSMO_SCCP_TIMER_IAR)
- "sccp-timer ias <seconds>" (OSMO_SCCP_TIMER_IAS)
Updated by pespin over 4 years ago
- For some reason, the IT message only shows up in wireshark in the STP->TTCN3 segment, despite I see from logs how it being sent first BSC->STP...
- I'm still unsure how to catch the SCCP IT message, I don't seem to be able to find in in TTCN3 logs so far.
I pushed what I have so far in osmo-ttcn3-hacks.git branch "pespin/sccp-timers".
Updated by laforge over 4 years ago
- I'm still unsure how to catch the SCCP IT message, I don't seem to be able to find in in TTCN3 logs so far.
I'm quite sure you cannot use the SCCP_Emulation (or anything on top)
to implement this test. It's a contradiction in terms. Imagine in TCP
you want to match on an ACK packet: Then you cannot use a TCP
implementation itself, but only the underlying IP implementation and send
hand-crafted TCP packets in order to match the ACK from the remote
implementation under test.
So here you would use the M3UA_Emulation directly and use raw SCCP
templates to create a connection (luckily just one message to transmit
and one to receive), and then wait until you see the IT coming in.
There's sccp/SCCP_Tests.ttcn which unfortunately also still uses
SCCP_Emulation. I can try to quickly create a template with the right
stacking / components.
Updated by laforge over 4 years ago
- Related to Bug #4355: osmo_sccp_simple_server_add_clnt() is broken added
Updated by pespin over 4 years ago
While you prepare the SCCP_Tests, I added a test to BSC_Tests to make sure channel is released fine in upper layers when the T(iar) timer times out:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/16798 bsc: Introduce test TC_chan_rel_sccp_tiar_timeout
Updated by pespin over 4 years ago
Similar test for osmo-msc:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/16799 msc: Introduce test TC_(iu_)chan_rel_sccp_tiar_timeout
Updated by pespin over 4 years ago
I have modified osmo-ttcn3-hacks/sccp files to use sccp_demo_user in server mode. I worked on a docker setup for docker-playground.git to easily run both SCCP_Tests and SCCP_Tests_RAW with the aim to have them running in jenkins.
I have work done so far in osmo-ttcn3-hacks and docker-playground.git in branch "pespin/sccp".
I have been fixing several bugs I found in our libosmo-sccp.git stack while running SCCP_Tests and SCCP_Tests_RAW against sccp_demo_user. Patches are in gerrit waiting for review.
Right now, I'm using TC_foo from SCCP_Tests_RAW which does:
f_send_sccp(ts_SCCP_CR('000001'O, called));
However, libosmo-sccp.git doesn't seem to like it:
DLSS7 osmo_ss7.c:1579 1: asp-asp-srv-client: xua_srv_conn_cb(): sctp_recvmsg() returned 36 (flags=0x80) DLM3UA m3ua.c:722 1: asp-asp-srv-client: Received M3UA Message (XFER:DATA) DLM3UA m3ua.c:541 1: asp-asp-srv-client: m3ua_rx_xfer DLM3UA m3ua.c:580 1: asp-asp-srv-client: m3ua_rx_xfer(): M3UA data header: opc=23=0.2.7 dpc=1=0.0.1 DLSS7 osmo_ss7_hmrt.c:274 m3ua_hmdc_rx_from_l2(): found dpc=1=0.0.1 as local DLSUA sccp2sua.c:333 IEI 259: Parsed Addr: RI=2,PC=1,SSN=254 DLSS7 sccp_scrc.c:449 scrc_rx_mtp_xfer_ind_xua: HDR=(CO:CORE,V=0,LEN=0), PART(T=Protocol Class,L=4,D=00000002), PART(T=Source Reference,L=4,D=00000001), PART(T=Destination Address,L=20,D=00020003800200080000000180030008000000fe) DLSUA sua.c:385 sua_addr_parse_part(IEI=0x0103) (20) 00 02 00 03 80 02 00 08 00 00 00 01 80 03 00 08 00 00 00 fe DLSUA sua.c:439 SUA IEI 0x0103 pos 4/20: subpart tag 0x8002, len 8 DLSUA sua.c:439 SUA IEI 0x0103 pos 12/20: subpart tag 0x8003, len 8 DLSS7 sccp_scrc.c:398 sccp_scrc_rx_scoc_conn_msg: HDR=(CO:COREF,V=0,LEN=0), PART(T=Routing Context,L=4,D=00000000), PART(T=Destination Reference,L=4,D=00000001), PART(T=Cause,L=4,D=00000213), PART(T=Source Address,L=20,D=00020003800200080000000180030008000000fe) DLSCCP sccp_scrc.c:138 MTP-TRANSFER.req from SCCP without DPC?!? called=RI=0 <-- ERROR; discard message.
I'm now trying to add calling address to ts_SCCP_CR but I'm having build issues due to optionalPart.callingPAddress being SCCP_param_CPartyAddressEnc_opt which uses"paramLength + SCCP_CPartyAddressEnc_addr" instead of SCCP_CPartyAddressEnc, and as a result ConvertASPAddressToEncodedAddress_itu cannot be used in place.
Here's the issue:
// type record SCCP_param_CPartyAddress_opt_itu type record SCCP_param_CPartyAddressEnc_opt { SCCP_field_ParameterName paramName(con_SCCP_cdPA, con_SCCP_cgPA), LIN1 paramLength, SCCP_CPartyAddressEnc_addr addr } with { variant (paramLength) "LENGTHTO( addr )"}
I'd make sense to change it to this imho, laforge what do you think?:
// type record SCCP_param_CPartyAddress_opt_itu type record SCCP_param_CPartyAddressEnc_opt { SCCP_field_ParameterName paramName(con_SCCP_cdPA, con_SCCP_cgPA), SCCP_CPartyAddressEnc addr }
Updated by laforge over 4 years ago
On Thu, Jan 16, 2020 at 07:47:31PM +0000, redmine@lists.osmocom.org wrote:
I have been fixing several bugs I found in our libosmo-sccp.git stack while running SCCP_Tests and SCCP_Tests_RAW against sccp_demo_user. Patches are in gerrit waiting for review.
this is really good news, and I would say that alone was worth the effort!
Right now, I'm using TC_foo from SCCP_Tests_RAW which does:
> f_send_sccp(ts_SCCP_CR('000001'O, called)); >
I would sugges to compare that generated packet with a packet from a normal SCCP
connection e.g. from a trace between BSC and MSC.
However, libosmo-sccp.git doesn't seem to like it:
> DLSS7 osmo_ss7.c:1579 1: asp-asp-srv-client: xua_srv_conn_cb(): sctp_recvmsg() returned 36 (flags=0x80) > DLM3UA m3ua.c:722 1: asp-asp-srv-client: Received M3UA Message (XFER:DATA) > DLM3UA m3ua.c:541 1: asp-asp-srv-client: m3ua_rx_xfer > DLM3UA m3ua.c:580 1: asp-asp-srv-client: m3ua_rx_xfer(): M3UA data header: opc=23=0.2.7 dpc=1=0.0.1 > DLSS7 osmo_ss7_hmrt.c:274 m3ua_hmdc_rx_from_l2(): found dpc=1=0.0.1 as local > DLSUA sccp2sua.c:333 IEI 259: Parsed Addr: RI=2,PC=1,SSN=254 > DLSS7 sccp_scrc.c:449 scrc_rx_mtp_xfer_ind_xua: HDR=(CO:CORE,V=0,LEN=0), PART(T=Protocol Class,L=4,D=00000002), PART(T=Source Reference,L=4,D=00000001), PART(T=Destination Address,L=20,D=00020003800200080000000180030008000000fe) > DLSUA sua.c:385 sua_addr_parse_part(IEI=0x0103) (20) 00 02 00 03 80 02 00 08 00 00 00 01 80 03 00 08 00 00 00 fe > DLSUA sua.c:439 SUA IEI 0x0103 pos 4/20: subpart tag 0x8002, len 8 > DLSUA sua.c:439 SUA IEI 0x0103 pos 12/20: subpart tag 0x8003, len 8 > DLSS7 sccp_scrc.c:398 sccp_scrc_rx_scoc_conn_msg: HDR=(CO:COREF,V=0,LEN=0), PART(T=Routing Context,L=4,D=00000000), PART(T=Destination Reference,L=4,D=00000001), PART(T=Cause,L=4,D=00000213), PART(T=Source Address,L=20,D=00020003800200080000000180030008000000fe) > DLSCCP sccp_scrc.c:138 MTP-TRANSFER.req from SCCP without DPC?!? called=RI=0 <-- ERROR; discard message. >
So why is there no DPC? a few lines above for the CR it states "M3UA data header: opc=23 dpc=1". I'm not
entirely sure, but I would think that it should send that SCCP COREF packet simply back to the point code from which the CR has been received, i.e. 23.
So my initial guess is that there's some bug / something missing from our SCCP implementation.
I'm now trying to add calling address to ts_SCCP_CR but I'm having build issues due to optionalPart.callingPAddress being SCCP_param_CPartyAddressEnc_opt which uses"paramLength + SCCP_CPartyAddressEnc_addr" instead of SCCP_CPartyAddressEnc, and as a result ConvertASPAddressToEncodedAddress_itu cannot be used in place.
I would generally try to do as little changes as possible to the upstream SCCP code,
particularly as we don't fully understand their use cases and hence might not get it
merged.
Updated by pespin over 4 years ago
First SCCP test checking t(ias) and T(iar) is available here:
remote: https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/16964 sccp: Stop test on rx unexpected sccp msg
remote: https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/16965 sccp: Introduce test TC_tiar_timeout
Updated by pespin over 4 years ago
- Status changed from In Progress to Feedback
- % Done changed from 0 to 90
I added more tests which do test the required scenarios from this ticket:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/16976 sccp: Introduce test TC_it_avoids_tiar
Apart from memleaks and crashes I spotted and fixed during TTCN3 developent, T(ias) and T(iar) seem to be working fine. I also submitted a patch to stop those timers when conn goes into pending disconnect state, since anyway when timer fires and the event is generated it was dropped by the FSM:
https://gerrit.osmocom.org/c/libosmo-sccp/+/16961
Once TTCN3 tests and libosmo-sccp.git patches are merged, we can close the ticket.
Updated by pespin over 4 years ago
- Status changed from Feedback to Resolved
- % Done changed from 90 to 100
All tests from SCCP_Tests(_RAW) are passing now in jenkins:
https://jenkins.osmocom.org/jenkins/view/TTCN3/job/ttcn3-sccp-test/test_results_analyzer/
closing the ticket.