pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39661?usp=email )
Change subject: stp: Fix brokeness in STP_Tests_IPA.TC_tmt_loadshare
......................................................................
stp: Fix brokeness in STP_Tests_IPA.TC_tmt_loadshare
Similar to previous commit for M3UA, this time for IPA.
Since in IPA so far the SLS is fixed per ASP, we need to add an extra
sender ASP which will get a new asp_id (and hence SLS) so that we can
also test traffic being sent/distributed to the 2nd receiver.
Change-Id: I61c3efbf8e30533d051e2de506f7c8eaae7e297b
---
M stp/STP_Tests.ttcn
M stp/STP_Tests_IPA.ttcn
M stp/expected-results.xml
M stp/osmo-stp.cfg
4 files changed, 150 insertions(+), 39 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/61/39661/1
diff --git a/stp/STP_Tests.ttcn b/stp/STP_Tests.ttcn
index e2e5336..60d68c9 100644
--- a/stp/STP_Tests.ttcn
+++ b/stp/STP_Tests.ttcn
@@ -69,7 +69,7 @@
f_init_m3ua();
f_init_ipa();
- f_connect_ipa(3);
+ f_connect_ipa(4);
f_M3UA_asp_up_act(0, omit, omit); // TODO: rctx
/* send a well-formed, encoded SCCP message via M3UA */
@@ -83,7 +83,7 @@
f_M3UA_send(0, ts_M3UA_DATA(rctx_sender, tx_pd), 1);
/* expect to receive it via IPA */
- f_IPA_exp(3, sccp_enc);
+ f_IPA_exp(4, sccp_enc);
f_clear_m3ua();
}
@@ -101,7 +101,7 @@
f_init_m3ua();
f_init_ipa();
- f_connect_ipa(3);
+ f_connect_ipa(4);
f_M3UA_asp_up_act(0, omit, omit); // TODO: rctx
/* send a well-formed, encoded SCCP message via IPA */
@@ -110,7 +110,7 @@
var SCCP_PAR_Address calling := valueof(ts_SccpAddr_GT('5678'H));
var PDU_SCCP sccp := valueof(ts_SCCP_UDT(called, calling, data));
var octetstring sccp_enc := enc_PDU_SCCP(sccp);
- f_IPA_send(3, sccp_enc);
+ f_IPA_send(4, sccp_enc);
/* expect to receive it via M3UA */
var template (present) M3UA_Protocol_Data rx_pd;
@@ -133,7 +133,7 @@
f_init_m3ua();
f_init_ipa();
- f_connect_ipa(3);
+ f_connect_ipa(4);
f_M3UA_asp_up_act(0, omit, omit); // TODO: rctx
/* send a well-formed, encoded SCCP message via IPA */
@@ -143,7 +143,7 @@
var PDU_SCCP sccp := valueof(ts_SCCP_UDT(called, calling, data));
var octetstring sccp_enc := enc_PDU_SCCP(sccp);
f_vty_config2(VTY, {"cs7 instance 0"}, "network-indicator
national");
- f_IPA_send(3, sccp_enc);
+ f_IPA_send(4, sccp_enc);
/* expect to receive it via M3UA */
var template (present) M3UA_Protocol_Data rx_pd;
@@ -168,7 +168,7 @@
f_init_m3ua();
f_init_ipa();
- f_connect_ipa(3);
+ f_connect_ipa(4);
f_M3UA_asp_up_act(0, omit, omit); // TODO: rctx
/* send a well-formed, encoded SCCP message via IPA */
@@ -176,7 +176,7 @@
var SCCP_PAR_Address called := valueof(ts_SccpAddr_GT('1234'H));
var SCCP_PAR_Address calling := valueof(ts_SccpAddr_GT('5678'H));
var PDU_SCCP sccp := valueof(ts_SCCP_UDT(called, calling, data));
- f_IPA_send(3, enc_PDU_SCCP(sccp));
+ f_IPA_send(4, enc_PDU_SCCP(sccp));
/* patch point codes into addresses */
called := valueof(ts_SccpAddr_PC_GT(oct2int(pc_receiver), '83'O,
"mtp3_itu", '1234'H));
diff --git a/stp/STP_Tests_IPA.ttcn b/stp/STP_Tests_IPA.ttcn
index 10367ad..088b280 100644
--- a/stp/STP_Tests_IPA.ttcn
+++ b/stp/STP_Tests_IPA.ttcn
@@ -15,6 +15,7 @@
import from General_Types all;
import from Osmocom_Types all;
import from IPL4asp_Types all;
+import from Misc_Helpers all;
import from TELNETasp_PortType all;
import from Osmocom_VTY_Functions all;
@@ -33,7 +34,7 @@
import from STP_Tests_Common all;
-private const integer NR_IPA := 7;
+private const integer NR_IPA := 8;
type record of charstring AspNameArray;
@@ -43,6 +44,7 @@
integer mp_stp_ipa_port := 5000;
integer mp_local_ipa_port := 20000;
AspNameArray mp_ipa_as_names := {"ipa-as-loadshare-sender",
+ "ipa-as-loadshare-sender",
"ipa-as-loadshare-receiver",
"ipa-as-loadshare-receiver",
"ipa-as-dynamic-asp",
@@ -170,18 +172,18 @@
f_init_ipa();
/* bring up the 'sender' side (single ASP in AS) */
- f_connect_ipa(4, unknwon_dynamic_asp);
- /* activate the first 'receiver' side ASP */
f_connect_ipa(5, unknwon_dynamic_asp);
-
- /* verify traffic is routed from sender to [sole] receiver */
- f_test_traffic(4, 5);
-
- /* activate the second 'receiver' side ASP */
+ /* activate the first 'receiver' side ASP */
f_connect_ipa(6, unknwon_dynamic_asp);
+ /* verify traffic is routed from sender to [sole] receiver */
+ f_test_traffic(5, 6);
+
+ /* activate the second 'receiver' side ASP */
+ f_connect_ipa(7, unknwon_dynamic_asp);
+
/* verify traffic is routed from sender to new receiver */
- f_test_traffic(4, 6);
+ f_test_traffic(5, 7);
setverdict(pass);
}
@@ -202,54 +204,156 @@
}
}
-private function f_tc_tmt_loadshare(boolean unknwon_dynamic_asp)
+private function f_tc_tmt_loadshare_roundrobin(boolean unknwon_dynamic_asp)
runs on IPA_CT {
var integer i;
f_init_ipa();
+ f_vty_config2(VTY, {"cs7 instance 0", "as " & mp_ipa_as_names[2]
& " ipa"}, "traffic-mode roundrobin");
+
/* bring up the 'sender' side (single ASP in AS) */
f_connect_ipa(0, unknwon_dynamic_asp);
/* activate the first 'receiver' side ASP */
- f_connect_ipa(1, unknwon_dynamic_asp);
+ f_connect_ipa(2, unknwon_dynamic_asp);
/* verify traffic is routed from sender to [sole] receiver */
for (i := 0; i < 10; i := i+1) {
- f_test_traffic(0, 1);
+ f_test_traffic(0, 2);
}
/* activate the second 'receiver' side ASP */
- f_connect_ipa(2, unknwon_dynamic_asp);
+ f_connect_ipa(3, unknwon_dynamic_asp);
/* verify traffic is routed from sender to new receiver */
const integer iter_per_asp := 5;
- var integer num_rx[3] := { 0, 0, 0 };
+ var integer num_rx[2] := { 0, 0 };
for (i := 0; i < 2*iter_per_asp; i := i+1) {
var octetstring data := f_rnd_octstring(f_rnd_ipa_len());
f_IPA_send(0, data);
alt {
- [] as_count_rx(1, data, num_rx[1]);
- [] as_count_rx(2, data, num_rx[2]);
+ [] as_count_rx(2, data, num_rx[0]);
+ [] as_count_rx(3, data, num_rx[1]);
}
}
/* FIXME: check for extraneous messages? */
- for (i := 1; i <= 2; i := i+1) {
+ for (i := 0; i < 2; i := i+1) {
if (num_rx[i] != iter_per_asp) {
setverdict(fail, "Received ", num_rx[i], " out of expected ",
iter_per_asp,
"DATA messages at IPA port ", i);
}
}
setverdict(pass);
+
+ f_vty_config2(VTY, {"cs7 instance 0", "as " & mp_ipa_as_names[2]
& " ipa"}, "no traffic-mode");
}
/* test "traffic-mode load-share" behavior */
-testcase TC_tmt_loadshare() runs on IPA_CT {
- f_tc_tmt_loadshare(false);
+testcase TC_tmt_loadshare_roundrobin() runs on IPA_CT {
+ f_tc_tmt_loadshare_roundrobin(false);
}
-/* test "traffic-mode override" behavior, with "accept-asp-connections
dynamic-permitted" and clients from unknown ASPs */
+private altstep as_count_rx_sls(integer idx, template (present) octetstring exp, inout
Integers sls_counter, inout integer rx_counter)
+runs on IPA_CT {
+ var ASP_MTP3_TRANSFERind rx;
+ [] IPA[idx].receive(t_ASP_MTP3_TRANSFERind(?, ?, ?, ?, exp)) -> value rx {
+ var integer sls := rx.sls; /* This should in general be 0 in IPA. */
+ sls_counter[sls] := sls_counter[sls] + 1;
+ rx_counter := rx_counter + 1;
+ }
+}
+
+private function f_tc_tmt_loadshare_sls(boolean unknwon_dynamic_asp)
+runs on IPA_CT {
+ var integer i;
+
+ f_init_ipa();
+
+ f_vty_config2(VTY, {"cs7 instance 0", "as " & mp_ipa_as_names[2]
& " ipa"}, "traffic-mode loadshare");
+
+ /* bring up the 'sender' side (single ASP in AS) */
+ f_connect_ipa(0, unknwon_dynamic_asp);
+ /* activate the first 'receiver' side ASP */
+ f_connect_ipa(2, unknwon_dynamic_asp);
+
+ /* verify traffic is routed from sender to [sole] receiver */
+ for (i := 0; i < 10; i := i+1) {
+ f_test_traffic(0, 2);
+ }
+
+ /* activate the second 'receiver' side ASP */
+ f_connect_ipa(3, unknwon_dynamic_asp);
+
+ /* verify traffic is routed from sender to new receiver */
+ const integer iter_per_asp := 20;
+ const integer NUM_SLS := 16; /* SLS in ITU is 4 bits. */
+ var integer num_rx_1 := 0;
+ var integer num_rx_2 := 0;
+ var Integers sls_num_rx_1 := {};
+ var Integers sls_num_rx_2 := {};
+ for (i := 0; i < NUM_SLS; i := i + 1) {
+ sls_num_rx_1 := sls_num_rx_1 & {0};
+ sls_num_rx_2 := sls_num_rx_2 & {0};
+ }
+ for (i := 0; i < iter_per_asp; i := i+1) {
+ var octetstring data := f_rnd_octstring(f_rnd_ipa_len());
+ f_IPA_send(0, data);
+ alt {
+ [] as_count_rx_sls(2, data, sls_num_rx_1, num_rx_1);
+ [] as_count_rx_sls(3, data, sls_num_rx_2, num_rx_2);
+ }
+ }
+
+ /* All traffic should have still be sent to the first receiver, since OPC+SLS cannot
change in IPA ASPs. */
+ if (num_rx_1 != iter_per_asp and num_rx_2 != 0) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Expected all traffic through
1st receiver!");
+ }
+
+
+ /* activate the second 'sender' side ASP */
+ f_connect_ipa(1, unknwon_dynamic_asp);
+
+
+ num_rx_1 := 0;
+ num_rx_2 := 0;
+ sls_num_rx_1 := {};
+ sls_num_rx_2 := {};
+ for (i := 0; i < NUM_SLS; i := i + 1) {
+ sls_num_rx_1 := sls_num_rx_1 & {0};
+ sls_num_rx_2 := sls_num_rx_2 & {0};
+ }
+ for (i := 0; i < 2*iter_per_asp; i := i+1) {
+ var octetstring data := f_rnd_octstring(f_rnd_ipa_len());
+ f_IPA_send(i mod 2, data);
+ alt {
+ [] as_count_rx_sls(2, data, sls_num_rx_1, num_rx_1);
+ [] as_count_rx_sls(3, data, sls_num_rx_2, num_rx_2);
+ }
+ }
+ /* Make sure traffic was sent over both ASPs and that it was distributed: */
+ if (num_rx_1 == 0) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx 0 packets in 1st
ASP!");
+ }
+ if (num_rx_2 == 0) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx 0 packets in 2nd
ASP!");
+ }
+ if (num_rx_1 + num_rx_2 != 2*iter_per_asp) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Rx ", num_rx_1 + num_rx_2 ," packets in total vs exp ",
2*iter_per_asp));
+ }
+ setverdict(pass);
+
+ f_vty_config2(VTY, {"cs7 instance 0", "as " & mp_ipa_as_names[2]
& " ipa"}, "no traffic-mode");
+}
+
+/* test "traffic-mode load-share" behavior */
+testcase TC_tmt_loadshare_sls() runs on IPA_CT {
+ f_tc_tmt_loadshare_sls(false);
+}
+
+/* test "traffic-mode loadshare" behavior, with "accept-asp-connections
dynamic-permitted" and clients from unknown ASPs */
testcase TC_unknown_client_dynamic_tmt_loadshare() runs on IPA_CT {
- f_tc_tmt_override(true);
+ f_tc_tmt_loadshare_sls(true);
}
control {
@@ -258,7 +362,8 @@
execute( TC_unknown_client_dynamic() );
execute( TC_tmt_override() );
execute( TC_unknown_client_dynamic_tmt_override() );
- execute( TC_tmt_loadshare() );
+ execute( TC_tmt_loadshare_roundrobin() );
+ execute( TC_tmt_loadshare_sls() );
execute( TC_unknown_client_dynamic_tmt_loadshare() );
}
diff --git a/stp/expected-results.xml b/stp/expected-results.xml
index a764349..3fbe1a5 100644
--- a/stp/expected-results.xml
+++ b/stp/expected-results.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<testsuite name='STP_Tests' tests='50' failures='0'
errors='0' skipped='0' inconc='0' time='MASKED'>
+<testsuite name='STP_Tests' tests='52' failures='0'
errors='0' skipped='0' inconc='0' time='MASKED'>
<testcase classname='STP_Tests_M3UA' name='TC_connect_asp_up'
time='MASKED'/>
<testcase classname='STP_Tests_M3UA' name='TC_beat'
time='MASKED'/>
<testcase classname='STP_Tests_M3UA' name='TC_beat_payload'
time='MASKED'/>
@@ -47,7 +47,8 @@
<testcase classname='STP_Tests_IPA' name='TC_unknown_client_dynamic'
time='MASKED'/>
<testcase classname='STP_Tests_IPA' name='TC_tmt_override'
time='MASKED'/>
<testcase classname='STP_Tests_IPA'
name='TC_unknown_client_dynamic_tmt_override' time='MASKED'/>
- <testcase classname='STP_Tests_IPA' name='TC_tmt_loadshare'
time='MASKED'/>
+ <testcase classname='STP_Tests_IPA'
name='TC_tmt_loadshare_roundrobin' time='MASKED'/>
+ <testcase classname='STP_Tests_IPA' name='TC_tmt_loadshare_sls'
time='MASKED'/>
<testcase classname='STP_Tests_IPA'
name='TC_unknown_client_dynamic_tmt_loadshare' time='MASKED'/>
<testcase classname='STP_Tests' name='TC_m3ua_to_ipa'
time='MASKED'/>
<testcase classname='STP_Tests' name='TC_ipa_to_m3ua'
time='MASKED'/>
diff --git a/stp/osmo-stp.cfg b/stp/osmo-stp.cfg
index f727d03..355bf20 100644
--- a/stp/osmo-stp.cfg
+++ b/stp/osmo-stp.cfg
@@ -115,19 +115,23 @@
!
! IPA AS/ASP:
!
- asp ipa-asp-loadshare-sender 20000 5000 ipa
+ asp ipa-asp-loadshare-sender0 20000 5000 ipa
+ local-ip 127.0.0.1
+ remote-ip 127.0.0.1
+ asp ipa-asp-loadshare-sender1 20001 5000 ipa
local-ip 127.0.0.1
remote-ip 127.0.0.1
as ipa-as-loadshare-sender ipa
routing-key 0 6
point-code override dpc 31
- asp ipa-asp-loadshare-sender
- asp ipa-asp-loadshare-receiver0 20001 5000 ipa
+ asp ipa-asp-loadshare-sender0
+ asp ipa-asp-loadshare-sender1
+ asp ipa-asp-loadshare-receiver0 20002 5000 ipa
local-ip 127.0.0.1
remote-ip 127.0.0.1
role sg
sctp-role server
- asp ipa-asp-loadshare-receiver1 20002 5000 ipa
+ asp ipa-asp-loadshare-receiver1 20003 5000 ipa
local-ip 127.0.0.1
remote-ip 127.0.0.1
role sg
@@ -138,20 +142,21 @@
point-code override dpc 32
asp ipa-asp-loadshare-receiver0
asp ipa-asp-loadshare-receiver1
+! Port 2004 is reserved for use with ipa-as-dynamic-asp in TTCN-3.
! OVERRIDE:
- asp ipa-asp-override-sender 20004 5000 ipa
+ asp ipa-asp-override-sender 20005 5000 ipa
local-ip 127.0.0.1
remote-ip 127.0.0.1
as ipa-as-override-sender ipa
routing-key 0 6
point-code override dpc 33
asp ipa-asp-override-sender
- asp ipa-asp-override-receiver0 20005 5000 ipa
+ asp ipa-asp-override-receiver0 20006 5000 ipa
local-ip 127.0.0.1
remote-ip 127.0.0.1
role sg
sctp-role server
- asp ipa-asp-override-receiver1 20006 5000 ipa
+ asp ipa-asp-override-receiver1 20007 5000 ipa
local-ip 127.0.0.1
remote-ip 127.0.0.1
role sg
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39661?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I61c3efbf8e30533d051e2de506f7c8eaae7e297b
Gerrit-Change-Number: 39661
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>