laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/32327 )
Change subject: stp: Add tests for setups with multiple "routing context 0" ASPs
......................................................................
stp: Add tests for setups with multiple "routing context 0" ASPs
These two test cases verify that
* libosmo-sigtran doesn't include a routing context IE even in ASP
role when using a ASP with a single routing context 0 configured
* osmo-stp can route between a single SG-role ASP with routing context
to two ASP-role ASPs which both have routing context 0 (i.e. no
routing context IE in use)
The tests do not pass with current libosmo-sigtran until OS#6003 is
fixed, presumably by Change-Id I5ce89b393a3b950ab7fd1eace9038718c9efcc51
Change-Id: I81052ece7d1cc8b43da6155356ed1c4d9620acdc
Related: OS#6003
---
M stp/STP_Tests_M3UA.ttcn
M stp/osmo-stp.cfg
2 files changed, 110 insertions(+), 1 deletion(-)
Approvals:
neels: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/stp/STP_Tests_M3UA.ttcn b/stp/STP_Tests_M3UA.ttcn
index 41b2e2c..5af894a 100644
--- a/stp/STP_Tests_M3UA.ttcn
+++ b/stp/STP_Tests_M3UA.ttcn
@@ -35,7 +35,7 @@
import from STP_Tests_Common all;
private const integer NR_M3UA := 3; /* number of M3UA clients in ATS */
-private const integer NR_M3UA_SRV := 1; /* number of M3UA servres in ATS */
+private const integer NR_M3UA_SRV := 3; /* number of M3UA servres in ATS */
modulepar {
/* STP-side IP addresses */
@@ -68,6 +68,20 @@
local_sctp_port := 10002,
point_code := 55,
routing_ctx := 1055
+ },
+ /* as-client60-norctx */
+ {
+ remote_sctp_port := 2907,
+ local_sctp_port := 11060,
+ point_code := 60,
+ routing_ctx := -
+ },
+ /* as-client61-norctx */
+ {
+ remote_sctp_port := 2907,
+ local_sctp_port := 11061,
+ point_code := 61,
+ routing_ctx := -
}
};
integer mp_recovery_timeout_msec := 2000;
@@ -793,6 +807,60 @@
f_clear_m3ua();
}
+/* Test traffic being routed through "server" side STP (M3UA SG), coming back in "client"
+ * side STP (M3UA ASP) which has no routing context set */
+testcase TC_clnt_sg_to_asp_norctx() runs on RAW_M3UA_CT {
+ var OCT4 rctx_sender := int2oct(mp_m3ua_configs[0].routing_ctx, 4);
+ var OCT4 pc_sender := int2oct(mp_m3ua_configs[0].point_code, 4);
+ var OCT4 pc_receiver := int2oct(mp_m3ua_configs[M3UA_SRV(1)].point_code, 4);
+ var OCT4 pc_receiver2 := int2oct(mp_m3ua_configs[M3UA_SRV(2)].point_code, 4);
+
+ /* activate the sender side (ATS is client to STP in SG role) */
+ f_init_m3ua();
+ f_M3UA_asp_up_act(0);
+
+ /* activate the receiver side (ATS is server to STP in ASP role) */
+ f_init_m3ua_srv();
+ f_M3UA_CLNT_asp_up_act(M3UA_SRV(1), rctx := omit);
+ /* activate another instance of STP in ASP role with no routing context */
+ f_M3UA_CLNT_asp_up_act(M3UA_SRV(2), rctx := omit);
+
+ f_sleep(1.0);
+
+ /* verify traffic is routed from sender to [sole] receiver for each PC */
+ f_test_traffic(0, rctx_sender, pc_sender, M3UA_SRV(1), omit, pc_receiver);
+ f_test_traffic(0, rctx_sender, pc_sender, M3UA_SRV(2), omit, pc_receiver2);
+
+ f_clear_m3ua();
+}
+
+/* Test traffic being routed through "server" side STP (M3UA SG), coming back in "client"
+ * side STP (M3UA ASP) which has no routing context set */
+testcase TC_clnt_asp_to_sg_norctx() runs on RAW_M3UA_CT {
+ var OCT4 rctx_receiver := int2oct(mp_m3ua_configs[0].routing_ctx, 4);
+ var OCT4 pc_receiver := int2oct(mp_m3ua_configs[0].point_code, 4);
+ var OCT4 pc_sender := int2oct(mp_m3ua_configs[M3UA_SRV(1)].point_code, 4);
+ var OCT4 pc_sender2 := int2oct(mp_m3ua_configs[M3UA_SRV(2)].point_code, 4);
+
+ /* activate the sender side (ATS is client to STP in SG role) */
+ f_init_m3ua();
+ f_M3UA_asp_up_act(0);
+
+ /* activate the receiver side (ATS is server to STP in ASP role) */
+ f_init_m3ua_srv();
+ f_M3UA_CLNT_asp_up_act(M3UA_SRV(1), rctx := omit);
+ /* activate another instance of STP in ASP role with no routing context */
+ f_M3UA_CLNT_asp_up_act(M3UA_SRV(2), rctx := omit);
+
+ f_sleep(1.0);
+
+ /* verify traffic is routed from sender to [sole] receiver for each PC */
+ f_test_traffic(M3UA_SRV(1), omit, pc_sender, 0, rctx_receiver, pc_receiver);
+ f_test_traffic(M3UA_SRV(2), omit, pc_sender2, 0, rctx_receiver, pc_receiver);
+
+ f_clear_m3ua();
+}
+
/* Test if ASPAC / ASPIA of one ASP generates DAVA / DUNA on other ASP */
testcase TC_ssnm_aspac_dava_aspia_duna() runs on RAW_M3UA_CT {
var OCT4 rctx0 := int2oct(mp_m3ua_configs[0].routing_ctx, 4);
@@ -1050,6 +1118,9 @@
execute( TC_clnt_sg_to_asp() );
execute( TC_clnt_asp_to_sg() );
+ execute( TC_clnt_sg_to_asp_norctx() );
+ execute( TC_clnt_asp_to_sg_norctx() );
+
execute( TC_clnt_quirk_no_notify_asp_act() );
execute( TC_clnt_no_daud_in_asp() );
execute( TC_clnt_quirk_daud_in_asp() );
diff --git a/stp/osmo-stp.cfg b/stp/osmo-stp.cfg
index 50c80d3..427eb34 100644
--- a/stp/osmo-stp.cfg
+++ b/stp/osmo-stp.cfg
@@ -53,6 +53,16 @@
remote-ip 127.0.0.1
sctp-role client
role asp
+ asp asp-client60-norctx0 11060 2907 m3ua
+ local-ip 127.0.0.1
+ remote-ip 127.0.0.1
+ sctp-role client
+ role asp
+ asp asp-client61-norctx0 11061 2907 m3ua
+ local-ip 127.0.0.1
+ remote-ip 127.0.0.1
+ sctp-role client
+ role asp
as as-sender m3ua
asp asp-sender
routing-key 1023 23
@@ -63,6 +73,12 @@
as as-client m3ua
routing-key 1055 55
asp asp-client0
+ as as-client60-norctx m3ua
+ routing-key 0 60
+ asp asp-client60-norctx0
+ as as-client61-norctx m3ua
+ routing-key 0 61
+ asp asp-client61-norctx0
!
! IPA AS/ASP:
!
@@ -116,6 +132,8 @@
update route 23 16777215 linkset as-sender
update route 42 16777215 linkset as-receiver
update route 55 16777215 linkset as-client
+ update route 60 16777215 linkset as-client60-norctx
+ update route 61 16777215 linkset as-client61-norctx
update route 31 16777215 linkset ipa-as-loadshare-receiver
update route 33 16777215 linkset ipa-as-override-receiver
update route 5 16777215 linkset ipa-as-dynamic-asp
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/32327
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I81052ece7d1cc8b43da6155356ed1c4d9620acdc
Gerrit-Change-Number: 32327
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
falconia has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/32184 )
Change subject: codec: add SID preening functions for FR & EFR
......................................................................
codec: add SID preening functions for FR & EFR
Those network elements which receive a stream of codec frames that
may come from the uplink of GSM call A and which are responsible
for preparing the frame stream for the downlink of GSM call B
(OsmoMGW feeding TRAU-DL, or OsmoBTS receiving RTP and feeding DL
to its PHY) must be prepared for the possibility that their
incoming frame stream may contain corrupted SID frames, presumably
from bit errors on radio link A. Per the rules of section 6.1.1
of GSM 06.31 for FR and GSM 06.81 for EFR, SID frames with just one
errored bit are still to be accepted as valid, whereas frames with
more corrupted bits which are still recognizable as SID are classified
as invalid SID.
In the case of a TrFO call, the entity switching from leg A UL to
leg B DL is responsible for *not* transmitting invalid SID frames
on the destination leg (they should be treated like BFIs), and any
deemed-valid SID frames that are forwarded should be preened,
correcting that one bit error they may exhibit. The functions
added here provide that functionality.
Change-Id: Iec5c1f2619a82499f61cb3e5a7cd03ff0f020ad8
---
M include/osmocom/codec/codec.h
M src/codec/gsm610.c
M src/codec/gsm660.c
3 files changed, 114 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/include/osmocom/codec/codec.h b/include/osmocom/codec/codec.h
index 2bdae60..364385b 100644
--- a/include/osmocom/codec/codec.h
+++ b/include/osmocom/codec/codec.h
@@ -94,6 +94,8 @@
enum osmo_gsm631_sid_class osmo_fr_sid_classify(const uint8_t *rtp_payload);
enum osmo_gsm631_sid_class osmo_efr_sid_classify(const uint8_t *rtp_payload);
+bool osmo_fr_sid_preen(uint8_t *rtp_payload);
+bool osmo_efr_sid_preen(uint8_t *rtp_payload);
int osmo_amr_rtp_enc(uint8_t *payload, uint8_t cmr, enum osmo_amr_type ft,
enum osmo_amr_quality bfi);
diff --git a/src/codec/gsm610.c b/src/codec/gsm610.c
index d29d9cb..4731e9e 100644
--- a/src/codec/gsm610.c
+++ b/src/codec/gsm610.c
@@ -389,3 +389,44 @@
else
return OSMO_GSM631_SID_CLASS_VALID;
}
+
+/*! Preen potentially-SID FR codec frame in RTP format, ensuring that it is
+ * either a speech frame or a valid SID, and if the latter, making it a
+ * perfect, error-free SID frame.
+ * \param[in] rtp_payload Buffer with RTP payload - must be writable!
+ * \returns true if the frame is good, false otherwise
+ */
+bool osmo_fr_sid_preen(uint8_t *rtp_payload)
+{
+ enum osmo_gsm631_sid_class sidc;
+ uint8_t *p, sub;
+
+ sidc = osmo_fr_sid_classify(rtp_payload);
+ switch (sidc) {
+ case OSMO_GSM631_SID_CLASS_SPEECH:
+ return true;
+ case OSMO_GSM631_SID_CLASS_INVALID:
+ return false;
+ case OSMO_GSM631_SID_CLASS_VALID:
+ /* "Rejuvenate" this SID frame, correcting any errors:
+ * zero out all bits that aren't LARc or Xmaxc, thereby
+ * clearing all SID code word bits and all unused/reserved
+ * bits. */
+ p = rtp_payload + 5; /* skip magic+LARc */
+ for (sub = 0; sub < 4; sub++) {
+ *p++ = 0;
+ *p++ &= 0x1F;
+ *p++ &= 0x80;
+ *p++ = 0;
+ *p++ = 0;
+ *p++ = 0;
+ *p++ = 0;
+ }
+ return true;
+ default:
+ /* There are only 3 possible SID classifications per GSM 06.31
+ * section 6.1.1, thus any other return value is a grave error
+ * in the code. */
+ OSMO_ASSERT(0);
+ }
+}
diff --git a/src/codec/gsm660.c b/src/codec/gsm660.c
index c6e694c..9b5c55a 100644
--- a/src/codec/gsm660.c
+++ b/src/codec/gsm660.c
@@ -351,3 +351,46 @@
else
return OSMO_GSM631_SID_CLASS_VALID;
}
+
+/*! Preen potentially-SID EFR codec frame in RTP format, ensuring that it is
+ * either a speech frame or a valid SID, and if the latter, making it a
+ * perfect, error-free SID frame.
+ * \param[in] rtp_payload Buffer with RTP payload - must be writable!
+ * \returns true if the frame is good, false otherwise
+ */
+bool osmo_efr_sid_preen(uint8_t *rtp_payload)
+{
+ enum osmo_gsm631_sid_class sidc;
+
+ sidc = osmo_efr_sid_classify(rtp_payload);
+ switch (sidc) {
+ case OSMO_GSM631_SID_CLASS_SPEECH:
+ return true;
+ case OSMO_GSM631_SID_CLASS_INVALID:
+ return false;
+ case OSMO_GSM631_SID_CLASS_VALID:
+ /* "Rejuvenate" this SID frame, correcting any errors:
+ * set all 95 SID code word bits to 1. */
+ rtp_payload[6] |= 0x6F;
+ rtp_payload[7] = 0xFF;
+ rtp_payload[8] = 0xFF;
+ rtp_payload[9] |= 0x80;
+ rtp_payload[12] |= 0x3B;
+ rtp_payload[13] = 0xFF;
+ rtp_payload[14] = 0xFF;
+ rtp_payload[15] |= 0xE0;
+ rtp_payload[19] = 0xFF;
+ rtp_payload[20] = 0xFF;
+ rtp_payload[21] = 0xFF;
+ rtp_payload[25] = 0xFF;
+ rtp_payload[26] |= 0xFC;
+ rtp_payload[27] = 0xFF;
+ rtp_payload[28] |= 0xC0;
+ return true;
+ default:
+ /* There are only 3 possible SID classifications per GSM 06.81
+ * section 6.1.1, thus any other return value is a grave error
+ * in the code. */
+ OSMO_ASSERT(0);
+ }
+}
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/32184
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iec5c1f2619a82499f61cb3e5a7cd03ff0f020ad8
Gerrit-Change-Number: 32184
Gerrit-PatchSet: 5
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged