summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaranjeiro2009-03-10 16:34:23 +0000
committerlaranjeiro2009-03-10 16:34:23 +0000
commita97529fc77f1883b320cb12110cca7f0d0c95255 (patch)
treee8c2e7618ca9c014e41cb7ae373121ad341e765c
parent0057d33e448a06d941268090e0a92bf85a715b94 (diff)
cp/sta/action: (See #161).
* Added the fsm_branch post when the handover_cnf is a hard handover. * cp/fsm: Added states and handover for the STA handover. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@4195 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cesar/cp/fsm/src/fsm/cp.fsm15
-rw-r--r--cesar/cp/sta/action/src/handover.c6
-rw-r--r--cesar/cp/sta/action/test/utest/Makefile3
-rw-r--r--cesar/cp/sta/action/test/utest/src/handover.c33
4 files changed, 53 insertions, 4 deletions
diff --git a/cesar/cp/fsm/src/fsm/cp.fsm b/cesar/cp/fsm/src/fsm/cp.fsm
index dde9ba2153..b013de395b 100644
--- a/cesar/cp/fsm/src/fsm/cp.fsm
+++ b/cesar/cp/fsm/src/fsm/cp.fsm
@@ -61,6 +61,11 @@ States:
CCO_HANDOVER_WAIT_HANDOVER_COUNTDOWN
Wait the handover countdown expires in the central beacon to leave the CCo status.
+ STA_HANDOVER_WAIT_CC_HANDOVER_INFO
+ The station waits the CC_HANDOVER_INFO message.
+ STA_HANDOVER_WAIT_COUNTDOWN_EXPIRES
+ The station is ready to become the new CCo and only waits the end of the HANDOVER countdown.
+
Events:
to_assoc
to_sc_assoc
@@ -379,6 +384,9 @@ STA:
avln_failure -> POWERON [NULL]
left -> USTA [NULL]
to_stop -> UNASSOCIATING [cp_sta_action_poweron__sta__to_stop]
+ CC_HANDOVER_REQ:hard -> STA_HANDOVER_WAIT_CC_HANDOVER_INFO [cp_sta_action_handover__handover]
+ CC_HANDOVER_REQ:else -> .
+ HOIP_EXPIRED -> . [cp_sta_action_assoc__authenticated__renew]
SC_STA:
BEACON_TIMER_EXPIRES -> . [cp_beacon_beacon_not_received]
@@ -500,3 +508,10 @@ CCO_HANDOVER_WAIT_CC_HANDOVER_INFO_RSP:
CCO_HANDOVER_WAIT_HANDOVER_COUNTDOWN:
HOIP_EXPIRED -> STA [cp_cco_action__cco__assoc_stop]
+
+STA_HANDOVER_WAIT_CC_HANDOVER_INFO:
+ CC_HANDOVER_INFO_IND -> STA_HANDOVER_WAIT_COUNTDOWN_EXPIRES [cp_sta_action_handover__handover_info_ind_receive]
+ HANDOVER_TIMEOUT -> STA [NULL]
+
+STA_HANDOVER_WAIT_COUNTDOWN_EXPIRES:
+ HOIP_EXPIRED -> CCO [cp_cco_action__assoc__cco_start]
diff --git a/cesar/cp/sta/action/src/handover.c b/cesar/cp/sta/action/src/handover.c
index 79f31fc856..ee1d7b93a7 100644
--- a/cesar/cp/sta/action/src/handover.c
+++ b/cesar/cp/sta/action/src/handover.c
@@ -16,6 +16,7 @@
#include "cp/sta/mgr/sta_mgr.h"
#include "cp/msg/msg.h"
#include "cp/cco/action/cco_action.h"
+#include "cp/fsm/fsm.h"
void
cp_sta_action_handover__handover (cp_t *ctx, cp_mme_rx_t *mme)
@@ -34,13 +35,14 @@ cp_sta_action_handover__handover (cp_t *ctx, cp_mme_rx_t *mme)
&& (CP_CCO_LEVEL == 0))
{
result = CP_MSG_CC_HANDOVER_CNF_RESULT_REJECT_SOFT_HANDOVER;
- /*TODO: FSM post */
}
else if (soft_hard == CP_MSG_CC_HANDOVER_REQ_HANDOVER_HARD)
{
/* Go to the handover hard branch. */
result = CP_MSG_CC_HANDOVER_CNF_RESULT_ACCEPT;
- /*TODO: FSM post */
+
+ if (reason != CP_MSG_CC_HANDOVER_REQ_REASON_USER_APPOINT)
+ cp_fsm_branch (ctx, STA, CC_HANDOVER_REQ, hard);
}
if (reason == CP_MSG_CC_HANDOVER_REQ_REASON_USER_APPOINT)
diff --git a/cesar/cp/sta/action/test/utest/Makefile b/cesar/cp/sta/action/test/utest/Makefile
index 389c220aab..47b134f308 100644
--- a/cesar/cp/sta/action/test/utest/Makefile
+++ b/cesar/cp/sta/action/test/utest/Makefile
@@ -9,7 +9,8 @@ test_sta_action_SOURCES = test_sta_action.c assoc.c drv.c info.c key.c \
core_stub.c beacon_stub.c cp_stub.c \
cco_stub.c scenario_actions.c sc_test.c
test_sta_action_MODULES = lib lib/scenario cp/sta/action cp/sta/mgr \
- cp/fsm/stub cp/secu mac/common cl/stub cl
+ cp/fsm/stub cp/secu mac/common cl/stub cl \
+ cp/cco/action/stub
cp_fsm_MODULE_SOURCES = tables.c
# For bridging MME tests.
diff --git a/cesar/cp/sta/action/test/utest/src/handover.c b/cesar/cp/sta/action/test/utest/src/handover.c
index aec0465eb6..9ac7371c88 100644
--- a/cesar/cp/sta/action/test/utest/src/handover.c
+++ b/cesar/cp/sta/action/test/utest/src/handover.c
@@ -74,6 +74,8 @@ handover_test_case__handover (test_t t)
.ok = true,
.soft_hard = CP_MSG_CC_HANDOVER_REQ_HANDOVER_HARD,
.reason = CP_MSG_CC_HANDOVER_REQ_REASON_CCO_SELECTION),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (STA, CC_HANDOVER_REQ, hard)),
SCENARIO_EVENT (cp_msg_cc_handover_cnf_send,
.peer = CP_MME_PEER (1 ,1),
.result =
@@ -83,6 +85,8 @@ handover_test_case__handover (test_t t)
.ok = true,
.soft_hard = CP_MSG_CC_HANDOVER_REQ_HANDOVER_HARD,
.reason = CP_MSG_CC_HANDOVER_REQ_REASON_CCO_LEAVING),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (STA, CC_HANDOVER_REQ, hard)),
SCENARIO_EVENT (cp_msg_cc_handover_cnf_send,
.peer = CP_MME_PEER (1 ,1),
.result =
@@ -112,7 +116,7 @@ handover_test_case__handover (test_t t)
SCENARIO_END
};
- test_begin (t, "CCo prefered")
+ test_begin (t, "STA")
{
scenario_run (t, handover_entries, &globals);
@@ -230,11 +234,38 @@ handover_test_case__handover_expires (test_t t)
}
void
+handover_test_case__handover_timeout (test_t test)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ cp_sta_action_init (&ctx.cp);
+
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+
+ test_case_begin (t, "Test handover timeout");
+
+ scenario_entry_t expires[] = {
+ SCENARIO_ACTION (handover__timeout),
+ SCENARIO_EVENT (cp_cco_action__assoc__cco_start),
+ SCENARIO_END
+ };
+
+ test_begin (t, "Expires")
+ {
+ scenario_run (t, expires, &globals);
+ }
+ test_end;
+}
+
+void
handover_test_cases (test_t t)
{
handover_test_case__handover (t);
handover_test_case__handover_info_recv (t);
handover_test_case__handover_expires (t);
+ handover_test_case__handover_timeout (t);
}
void