pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40521?usp=email )
Change subject: stp: m3ua: Introduce test TC_combinedlset_loadshare ......................................................................
stp: m3ua: Introduce test TC_combinedlset_loadshare
Test combined linkset loadsharing on M3UA AS.
Related: SYS#7112 Change-Id: I20a67648072f4d9839b1d1fceded1680362bf979 --- M stp/STP_Tests_M3UA.cfg M stp/STP_Tests_M3UA.ttcn M stp/expected-results.xml M stp/osmo-stp-m3ua.confmerge 4 files changed, 129 insertions(+), 1 deletion(-)
Approvals: osmith: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/stp/STP_Tests_M3UA.cfg b/stp/STP_Tests_M3UA.cfg index dd0c97b..860bdd7 100644 --- a/stp/STP_Tests_M3UA.cfg +++ b/stp/STP_Tests_M3UA.cfg @@ -40,6 +40,24 @@ routing_ctx := 1042 }, { + asp_name := "asp-LS0-0-0", + is_server := false, + use_tcp := false, + remote_port := 2905, + local_port := 10002, + point_code := 44, + routing_ctx := 1044 + }, + { + asp_name := "asp-LS0-1-0", + is_server := false, + use_tcp := false, + remote_port := 2905, + local_port := 10003, + point_code := 45, + routing_ctx := 1045 + }, + { asp_name := "asp-client0", is_server := true, use_tcp := false, diff --git a/stp/STP_Tests_M3UA.ttcn b/stp/STP_Tests_M3UA.ttcn index 497bd82..a98ffdc 100644 --- a/stp/STP_Tests_M3UA.ttcn +++ b/stp/STP_Tests_M3UA.ttcn @@ -1655,6 +1655,90 @@ f_clear_m3ua(); }
+/* Test AS Loadsharing, (distributing traffic within linksets/ASs of a combined linkset). + * STP routing table is configured with 1 combined linkset towards PC 99 mask /14 with 2 + * AS routes ("as-LS0-0", "as-LS0-1") with same priority, each using 1 ASP ("asp-LS0-0-0", + * "asp-LS0-1-0"). Hence, traffic towards PC 99 received at asp-sender should be routed + * in loadshare fashion between those 2 AS/ASPs. + */ +testcase TC_combinedlset_loadshare() runs on RAW_M3UA_CT { + var integer i; + var Misc_Helpers.ro_charstring asps := { "asp-sender", "asp-LS0-0-0", "asp-LS0-1-0" }; + var M3uaConfigs m3ua_configs := m3ua_build_configs(asps); + var OCT4 rctx_sender := int2oct(m3ua_configs[0].routing_ctx, 4); + var OCT4 pc_sender := int2oct(m3ua_configs[0].point_code, 4); + var OCT4 rctx_receiver := int2oct(m3ua_configs[1].routing_ctx, 4); + var OCT4 rctx_receiver2 := int2oct(m3ua_configs[2].routing_ctx, 4); + var OCT4 pc_receiver := int2oct(99, 4); + + f_init_m3ua(m3ua_configs := m3ua_configs); + + /* bring up the 'sender' side (single ASP in AS) */ + f_M3UA_asp_up_act(0, omit, rctx_sender); + + /* activate the first 'receiver' side ASP */ + f_M3UA_asp_up_act(1, c_M3UA_TMT_override, rctx_receiver); + + /* verify traffic is routed from sender to [sole] receiver */ + for (i := 0; i < 10; i := i+1) { + f_test_traffic(0, rctx_sender, pc_sender, 1, rctx_receiver, pc_receiver); + } + + /* activate the second 'receiver' side ASP+AS */ + f_M3UA_asp_up_act(2, c_M3UA_TMT_override, rctx_receiver); + + /* 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 < 2*iter_per_asp; i := i+1) { + var octetstring data := f_rnd_octstring_rnd_len(100); + var template (value) M3UA_Protocol_Data tx_pd; + var template (present) M3UA_Protocol_Data rx_pd; + /* Distribute traffic over ASPs based on SLS, since OPC is always the same. + * SLS in ITU is 4 bits. */ + var OCT1 sls := int2oct(i mod 16, 1); + tx_pd := ts_M3UA_protocol_data(pc_sender, pc_receiver, '23'O, '00'O, '00'O, sls, data); + rx_pd := tr_M3UA_protocol_data(pc_sender, pc_receiver, '23'O, '00'O, '00'O, sls, data); + f_M3UA_send(0, ts_M3UA_DATA(rctx_sender, tx_pd), 1); + alt { + [] as_count_rx_sls(1, tr_M3UA_DATA(rctx_receiver, rx_pd), sls_num_rx_1, num_rx_1); + [] as_count_rx_sls(2, tr_M3UA_DATA(rctx_receiver2, rx_pd), 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)); + } + + /* Check that a given SLS is not forwarded to both ASPs: */ + for (i := 0; i < NUM_SLS; i := i+1) { + if (sls_num_rx_1[i] > 0 and sls_num_rx_2[i] > 0) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str("Rx packets for SLS ", i, " in both ASPs!")); + } + + } + setverdict(pass); + + f_clear_m3ua(); +} + control { /* M3UA Tests */ execute( TC_connect_asp_up() ); @@ -1671,6 +1755,7 @@ execute( TC_tmt_broadcast() ); execute( TC_act_rctx_data_no_rctx() ); execute( TC_m3ua_sctp_srv_adm_shutdown() ); + execute( TC_combinedlset_loadshare() );
/* M3UA RKM tests */ execute( TC_rkm_reg_static_notpermitted() ); diff --git a/stp/expected-results.xml b/stp/expected-results.xml index fde8564..646ca7b 100644 --- a/stp/expected-results.xml +++ b/stp/expected-results.xml @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<testsuite name='STP_Tests' tests='59' failures='0' errors='0' skipped='0' inconc='0' time='MASKED'> +<testsuite name='STP_Tests' tests='60' 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'/> @@ -14,6 +14,7 @@ <testcase classname='STP_Tests_M3UA' name='TC_tmt_broadcast' time='MASKED'/> <testcase classname='STP_Tests_M3UA' name='TC_act_rctx_data_no_rctx' time='MASKED'/> <testcase classname='STP_Tests_M3UA' name='TC_m3ua_sctp_srv_adm_shutdown' time='MASKED'/> + <testcase classname='STP_Tests_M3UA' name='TC_combinedlset_loadshare' time='MASKED'/> <testcase classname='STP_Tests_M3UA' name='TC_rkm_reg_static_notpermitted' time='MASKED'/> <testcase classname='STP_Tests_M3UA' name='TC_rkm_reg_static_permitted' time='MASKED'/> <testcase classname='STP_Tests_M3UA' name='TC_rkm_reg_dynamic_permitted' time='MASKED'/> diff --git a/stp/osmo-stp-m3ua.confmerge b/stp/osmo-stp-m3ua.confmerge index 65e2fa2..5bc337f 100644 --- a/stp/osmo-stp-m3ua.confmerge +++ b/stp/osmo-stp-m3ua.confmerge @@ -23,6 +23,21 @@ remote-ip ::1 role sg sctp-role server + ! CombinedLinkset-loadsharing ASPs: + asp asp-LS0-0-0 10002 2905 m3ua + local-ip 127.0.0.1 + local-ip ::1 + remote-ip 127.0.0.1 + remote-ip ::1 + role sg + sctp-role server + asp asp-LS0-1-0 10003 2905 m3ua + local-ip 127.0.0.1 + local-ip ::1 + remote-ip 127.0.0.1 + remote-ip ::1 + role sg + sctp-role server asp asp-client0 10002 2906 m3ua local-ip 127.0.0.1 local-ip ::1 @@ -51,6 +66,13 @@ asp asp-receiver0 asp asp-receiver1 routing-key 1042 42 + ! CombinedLinkset-loadsharing ASs: + as as-LS0-0 m3ua + routing-key 1044 44 + asp asp-LS0-0-0 + as as-LS0-1 m3ua + routing-key 1045 45 + asp asp-LS0-1-0 as as-client m3ua routing-key 1055 55 asp asp-client0 @@ -66,6 +88,8 @@ route-table system update route 23 16777215 linkset as-sender update route 42 16777215 linkset as-receiver + update route 99 16777215 linkset as-LS0-0 priority 3 + update route 99 16777215 linkset as-LS0-1 priority 3 update route 55 16777215 linkset as-client update route 60 16777215 linkset as-client60-norctx update route 61 16777215 linkset as-client61-norctx