pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42547?usp=email )
Change subject: stp: Move NTFY expect to up & act step helper functions ......................................................................
stp: Move NTFY expect to up & act step helper functions
Change-Id: Ia835a5dd54cc37f529ca1c4ff9892d44fe239241 --- M stp/STP_Tests_M3UA.ttcn 1 file changed, 26 insertions(+), 31 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/47/42547/1
diff --git a/stp/STP_Tests_M3UA.ttcn b/stp/STP_Tests_M3UA.ttcn index 59839b0..ec456a2 100644 --- a/stp/STP_Tests_M3UA.ttcn +++ b/stp/STP_Tests_M3UA.ttcn @@ -457,9 +457,14 @@ ***********************************************************************/
/* perform an outbound ASP-UP procedure */ -friend function f_M3UA_asp_up(integer idx, template (omit) OCT4 aspid := omit) runs on RAW_M3UA_CT { +friend function f_M3UA_asp_up(integer idx, template (omit) OCT4 aspid := omit, + template (omit) OCT2 ntfy_after_up := c_M3UA_ST_I_AS_INACTIVE) runs on RAW_M3UA_CT { f_M3UA_send(idx, ts_M3UA_ASPUP(aspid)); f_M3UA_exp(idx, tr_M3UA_ASPUP_ACK); + + if (not istemplatekind(ntfy_after_up, "omit")) { + f_M3UA_exp(idx, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, ntfy_after_up, *)); + } }
/* perform an outbound BEAT procedure */ @@ -475,9 +480,14 @@
/* perform an outbound ASP-ACTIVATE procedure */ friend function f_M3UA_asp_act(integer idx, template (omit) M3UA_Traffic_Mode_Type tmt := omit, - template (omit) OCT4 rctx := omit) runs on RAW_M3UA_CT { + template (omit) OCT4 rctx := omit, + template (omit) OCT2 ntfy_after_act := c_M3UA_ST_I_AS_ACTIVE) runs on RAW_M3UA_CT { f_M3UA_send(idx, ts_M3UA_ASPAC(tmt, rctx)); f_M3UA_exp(idx, tr_M3UA_ASPAC_ACK(tmt, rctx)); + + if (not istemplatekind(ntfy_after_act, "omit")) { + f_M3UA_exp(idx, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, ntfy_after_act, *)); + } }
/* perform an outbound ASP-INACTIVATE procedure */ @@ -486,21 +496,15 @@ f_M3UA_exp(idx, tr_M3UA_ASPIA_ACK(rctx)); }
-/* perform outbound ASP-UP and ASP-ACT, optionally expect interemittent NOTIFY */ +/* perform outbound ASP-UP and ASP-ACT, optionally expect intermittent NOTIFY */ friend function f_M3UA_asp_up_act(integer idx, template (omit) M3UA_Traffic_Mode_Type tmt := omit, template (omit) OCT4 rctx := omit, template (omit) OCT2 ntfy_after_up := c_M3UA_ST_I_AS_INACTIVE, template (omit) OCT2 ntfy_after_act := c_M3UA_ST_I_AS_ACTIVE, template (omit) boolean exp_duna_after_act := omit /* auto */) runs on RAW_M3UA_CT { - f_M3UA_asp_up(idx, omit); - if (not istemplatekind(ntfy_after_up, "omit")) { - f_M3UA_exp(idx, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, ntfy_after_up, *)); - } - f_M3UA_asp_act(idx, tmt, rctx); - if (not istemplatekind(ntfy_after_act, "omit")) { - f_M3UA_exp(idx, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, ntfy_after_act, *)); - } + f_M3UA_asp_up(idx, omit, ntfy_after_up); + f_M3UA_asp_act(idx, tmt, rctx, ntfy_after_act); if (g_iut_supports_rfc666_4_5_1_duna_after_act) { var boolean exp_duna; if (istemplatekind(exp_duna_after_act, "omit")) { @@ -521,16 +525,14 @@ /* Test the ASP-UP procedure */ testcase TC_connect_asp_up() runs on RAW_M3UA_CT { f_init_m3ua(); - f_M3UA_asp_up(0); - f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_INACTIVE, *)); + f_M3UA_asp_up(0, ntfy_after_up := c_M3UA_ST_I_AS_INACTIVE); f_clear_m3ua(); }
/* Test the heartbeat procedure without optional heartbeat data payload */ testcase TC_beat() runs on RAW_M3UA_CT { f_init_m3ua(); - f_M3UA_asp_up(0); - f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_INACTIVE, *)); + f_M3UA_asp_up(0, ntfy_after_up := c_M3UA_ST_I_AS_INACTIVE); f_M3UA_beat(0, omit); f_clear_m3ua(); } @@ -538,8 +540,7 @@ /* Test the heartbeat procedure with optional heartbeat data payload */ testcase TC_beat_payload() runs on RAW_M3UA_CT { f_init_m3ua(); - f_M3UA_asp_up(0); - f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_INACTIVE, *)); + f_M3UA_asp_up(0, ntfy_after_up := c_M3UA_ST_I_AS_INACTIVE); f_M3UA_beat(0, 'a1a2a3a4a5'O); f_clear_m3ua(); } @@ -558,8 +559,7 @@ f_init_m3ua_srv(); f_M3UA_CLNT_asp_up_act(0, rctx := int2oct(m3ua_configs[0].routing_ctx, 4)); } else { - f_M3UA_asp_up(0); - f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_INACTIVE, *)); + f_M3UA_asp_up(0, ntfy_after_up := c_M3UA_ST_I_AS_INACTIVE); }
rx := f_M3UA_exp(0, tr_M3UA_BEAT(*), timeout_val := timeout_val, answer_beat := false); @@ -1070,10 +1070,10 @@
/* then activate the ASP, this turns the 2 AS (one for each rctx, 1234 and default 1023) * INACTIVE, handle the 2 NOTIFY manually afterwards: */ - f_M3UA_asp_up(0, omit); + f_M3UA_asp_up(0, ntfy_after_up := omit); f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_INACTIVE, (rctxA & rctxB, rctxB & rctxA))); f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_INACTIVE, (rctxA & rctxB, rctxB & rctxA))); - f_M3UA_asp_act(0, omit, rctxB); + f_M3UA_asp_act(0, omit, rctxB, ntfy_after_act := omit); f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_ACTIVE, (rctxA & rctxB, rctxB & rctxA))); f_M3UA_exp(0, tr_M3UA_DAVA({ts_M3UA_PC(oct2int(dpcB))}, rctxA)); if (g_iut_supports_rfc666_4_5_1_duna_after_act) { @@ -1120,7 +1120,7 @@ f_init_m3ua(m3ua_configs := m3ua_configs);
/* ASPUP + ACK */ - f_M3UA_asp_up(0); + f_M3UA_asp_up(0, ntfy_after_up := omit);
/* REG REQ + RESP */ f_M3UA_send(0, ts_M3UA_REG_REQ({ts_M3UA_rkey(id:='00000001'O, @@ -1133,7 +1133,6 @@
/* ASPAC + ACK */ f_M3UA_asp_act(0, c_M3UA_TMT_loadshare, rctx0); - f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_ACTIVE, *));
f_vty_config2(VTY, {"cs7 instance 0"}, "xua rkm routing-key-allocation static-only"); f_clear_m3ua(); @@ -1169,7 +1168,7 @@
///////// ASP 0 ///////////// /* ASPUP + ACK */ - f_M3UA_asp_up(0); + f_M3UA_asp_up(0, ntfy_after_up := omit);
/* REG REQ + RESP */ f_M3UA_send(0, ts_M3UA_REG_REQ({ts_M3UA_rkey(id:='00000001'O, @@ -1182,11 +1181,10 @@
/* ASPAC + ACK */ f_M3UA_asp_act(0, c_M3UA_TMT_loadshare, rctx0); - f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_ACTIVE, *));
///////// ASP 1 ///////////// /* ASPUP + ACK */ - f_M3UA_asp_up(1); + f_M3UA_asp_up(1, ntfy_after_up := omit);
/* REG REQ + RESP */ f_M3UA_send(1, ts_M3UA_REG_REQ({ts_M3UA_rkey(id:='00000001'O, @@ -1199,11 +1197,8 @@ * ASPUP+ASPUP-ACK to let it know AS state. */ f_M3UA_exp(1, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_ACTIVE, *));
- /* ASPAC + ACK */ - f_M3UA_asp_act(1, c_M3UA_TMT_loadshare, rctx1); - /* See RFC 4666 5.1.4: No NOTIFY is sent because there's no state change. - * f_M3UA_exp(1, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_ACTIVE, *)); - */ + /* ASPAC + ACK: See RFC 4666 5.1.4: No NOTIFY(c_M3UA_ST_I_AS_ACTIVE) is sent because there's no state change. */ + f_M3UA_asp_act(1, c_M3UA_TMT_loadshare, rctx1, ntfy_after_act := omit);
f_vty_config2(VTY, {"cs7 instance 0"}, "xua rkm routing-key-allocation static-only"); f_clear_m3ua();