summaryrefslogtreecommitdiff
path: root/cesar/test_general
diff options
context:
space:
mode:
authorlaranjeiro2010-06-07 15:58:32 +0000
committerlaranjeiro2010-06-07 15:58:32 +0000
commitf7ea3977e37c7abd74bfe6cf7abf7ee95e6eb163 (patch)
tree60432a396bb16493e5609717964dd845ae3c7a8b /cesar/test_general
parent4bc35cc73cbfaf21750318100c5bfd777f86d814 (diff)
cesar/cp/{beacon, cco/action, fsm}: fix handover start
- cp/beacon: remove the event post HANDOVER_DISCOVER_STA, the CCo elects the future CCo on DISCOVER_PROCESS_DONE event. - cp/cco/action: clear CCo selection heap when not used. - tests: Had a check to verify the CCo will not do a handover if the STA had not a bigger CCO_CAP (even if the STA is user cco appoint). git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7182 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/test_general')
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc07_handover.py86
1 files changed, 86 insertions, 0 deletions
diff --git a/cesar/test_general/station/cco0/s2/py/sc07_handover.py b/cesar/test_general/station/cco0/s2/py/sc07_handover.py
new file mode 100644
index 0000000000..d5e39c2dd5
--- /dev/null
+++ b/cesar/test_general/station/cco0/s2/py/sc07_handover.py
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+
+#############################################################################
+# #
+# The handover shall only occur when no other countdown is active. #
+# This test verifies it by activating a SNID collision on the AVLNS at #
+# the same time as the CCo should handover. #
+# #
+# One AVLNs, 3 stations. #
+# AVLN 1 contains three stations. #
+# #
+# Result expected: The handover should only occur after the SNID changed. #
+# #
+# Some others test will be done for the hybrid mode. #
+#############################################################################
+
+import unittest, sys, os
+sys.path.append ('../../../../maximus/python/tools/csi/')
+sys.path.append ('../../../../maximus/python/obj/')
+sys.path.append ('../../../../maximus/python/')
+sys.path.append ('../../../../maximus/python/lib/cesar')
+
+from csicore import csiCore
+from csistation import csiSta
+
+DEFAULT_MAC = '00:13:d7:00:00:%02x'
+NB_STA = 2
+DEBUG = False
+EXECUTABLE = 'obj/cco0s2.elf'
+
+csi = csiCore (1234)
+csi.process_init (sys.argv + ['-e', EXECUTABLE])
+# Creating an AVLN.
+avln = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
+
+for i in range (0, NB_STA):
+ if i != NB_STA - 1:
+ avln.sta_add (DEFAULT_MAC % (i + 1), False, False,
+ "SPIDCOM_CCO_LEVEL0_STEP2_" + str (i+1),
+ "SPIDCOM_SPC_300_" + str (i+1), "SPIDCOM_SPC_300_" + str (i+1),
+ 1, DEBUG)
+ else:
+ avln.sta_add (DEFAULT_MAC % (i + 1), True, False,
+ "SPIDCOM_CCO_LEVEL0_STEP2_" + str (i+1),
+ "SPIDCOM_SPC_300_" + str (i+1), "SPIDCOM_SPC_300_" + str (i+1),
+ 1, DEBUG)
+
+class TestHandover (unittest.TestCase):
+
+ def setUp (self):
+ pass
+
+ def tearDown (self):
+ pass
+
+ def testHandover (self):
+ """Test the handover from station 1 to station NB_STA - 1.
+ Last station of the AVLN is CCO user appointed.
+ HPAV require on a handover on the CCo CAP of a station, user appointed
+ is optional.
+ """
+ from own_data import Station_own_data
+ csi.process_sta_start (avln.get_sta (0))
+ csi.process_wait_sec (4)
+ for i in range (1, NB_STA):
+ csi.process_sta_start (avln.get_sta(i))
+ csi.process_wait_association ()
+ csi.process_wait_authentication ()
+ csi.process_wait_sec (20)
+ data = Station_own_data ()
+ data.get_data (csi.get_maximus (),
+ avln.get_sta (0).get_sta_cesar ())
+ self.failUnless (data.cco_prefered == False)
+ self.failUnless (data.is_cco == True)
+ data.get_data (csi.get_maximus (),
+ avln.get_sta (NB_STA - 1).get_sta_cesar ())
+ self.failUnless (data.cco_prefered == True)
+ self.failUnless (data.is_cco == False)
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestHandover)
+testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+
+csi.process_avlns_remove ()
+# For nightly build errors
+sys.exit ((1, 0)[testResult.wasSuccessful ()])
+os.system ('killall cco0s2.elf')