From e23387a1887fa8b20038fab238c35598bac9043e Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Sun, 6 Jun 2021 23:15:42 +0200 Subject: [PATCH] NS_Tests: add test case TC_sns_bss_add_change_del 1. do SNS configuration 2. add a bind 3. receive the SNS_ADD 4. before answering the SNS_ADD, change the weight via vty and remove the bind Related: OS#5036 Change-Id: Ibc565bba4c7e0a0b4dd28a48847dbdb998c8528d --- ns/NS_Tests.ttcn | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn index 3971f0d06..8bbb43c03 100644 --- a/ns/NS_Tests.ttcn +++ b/ns/NS_Tests.ttcn @@ -580,6 +580,52 @@ testcase TC_sns_bss_del() runs on RAW_Test_CT { f_clean_ns_codec(); } +/* 1. do SNS configuration + * 2. add a bind + * 3. receive the SNS_ADD + * 4. before answering the SNS_ADD, change the weight via vty and remove the bind + */ +testcase TC_sns_bss_add_change_del() runs on RAW_Test_CT { + var PDU_NS rx; + var NSVCConfiguration nsvc_cfg; + + g_handle_rx_alive := true; + f_init_vty(); + f_init_ns_codec(mp_nsconfig); + f_init_ns_codec(mp_nsconfig, 1); + f_incoming_sns_size(); + f_incoming_sns_config(); + f_outgoing_sns_config(); + activate(as_rx_alive_tx_ack()); + f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2"); + + /* rx SNS ADD */ + nsvc_cfg := g_nsconfig.nsvc[1]; + if (nsvc_cfg.provider.ip.address_family == AF_INET) { + var template (omit) IP4_Elements v4_elem := { ts_SNS_IPv4(nsvc_cfg.provider.ip.remote_ip, + nsvc_cfg.provider.ip.remote_udp_port, + 1, 1) }; + rx := f_ns_exp(tr_SNS_ADD(g_nsconfig.nsei, ?, v4 := v4_elem), 0); + } else { + var template (omit) IP6_Elements v6_elem := { ts_SNS_IPv6(nsvc_cfg.provider.ip.remote_ip, + nsvc_cfg.provider.ip.remote_udp_port, + 1, 1) }; + rx := f_ns_exp(tr_SNS_ADD(g_nsconfig.nsei, ?, omit, v6_elem), 0); + } + + /* delete the endpoint */ + f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns signalling-weight 99 data-weight 99"); + f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "no ip-sns-bind local2"); + + /* accept the SNS_ADD */ + NSCP[0].send(ts_SNS_ACK(g_nsconfig.nsei, rx.pDU_SNS_Add.transactionID)); + + f_incoming_sns_chg_weight(idx_chg := 1); + f_incoming_sns_del(idx_del := 1, w_sig := 99, w_user := 99); + setverdict(pass); + f_clean_ns_codec(); +} + control { if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == NS2_DIALECT_IPACCESS) { execute( TC_tx_reset() ); @@ -629,6 +675,7 @@ control { execute( TC_sns_bss_change_weight_timeout() ); execute( TC_sns_bss_add() ); execute( TC_sns_bss_del() ); + execute( TC_sns_bss_add_change_del() ); } }