summaryrefslogtreecommitdiff
path: root/cesar/test_general
diff options
context:
space:
mode:
authorNélio Laranjeiro2010-10-20 16:41:07 +0200
committerNélio Laranjeiro2010-10-20 17:05:21 +0200
commit9f517433a0df4dcea3acbad5cbd13f8b2d85d26f (patch)
tree36c459104f3677171a98900cccbe3417828dd47a /cesar/test_general
parent1a175608f484ae9abc977b63a05b615968e678ba (diff)
cesar/{cp, bsu}: adapt for new UCCo behavior, closes #695
Diffstat (limited to 'cesar/test_general')
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc15_two_avlns.py89
1 files changed, 89 insertions, 0 deletions
diff --git a/cesar/test_general/station/cco0/s2/py/sc15_two_avlns.py b/cesar/test_general/station/cco0/s2/py/sc15_two_avlns.py
new file mode 100644
index 0000000000..3de9113639
--- /dev/null
+++ b/cesar/test_general/station/cco0/s2/py/sc15_two_avlns.py
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2010 Spidcom
+#
+# UCCo behavior. A first station will start alone, and then two stations on
+# another AVLN will start.
+#
+# UCCo of the first AVLN should go to the unassociated STA and should send
+# CM_UNASSOCIATED_STA.IND over the PWL.
+#############################################################################
+
+import os
+import unittest
+import sys
+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 *
+
+csi = csiCore (1234)
+MACSDEFAULT = "00:13:d7:00:0%x:%02x"
+# Creating an AVLN.
+avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
+avln1_sta_nb = 1
+# Adding the stations.
+avln1_stas = list ()
+for i in range (0, avln1_sta_nb):
+ avln1_stas.append (avln1.sta_add (MACSDEFAULT % (1, i+1), False, False,
+ "HomePlug_AVLN1_Station%d" % (i+1),
+ "av1_spc300_sta%d" % (i+1),
+ "avln1_station%d" % (i+1), 1, False))
+avln2 = csi.avln_add ("Homeplug_AVLN2", "AVLN2")
+avln2_sta_nb = 2
+# Adding the stations.
+avln2_stas = list ()
+for i in range (0, avln2_sta_nb):
+ avln2_stas.append (avln2.sta_add (MACSDEFAULT % (2, i+1), False, False,
+ "HomePlug_AVLN2_Station%d" % (i+1),
+ "av2_spc300_sta%d" % (i+1),
+ "avln2_station%d" % (i+1), 1, False))
+
+class TestTwoAVLNS(unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testIT (self):
+ """Launch the first AVLN and check the lonely STA is CCo.
+ The second AVLN starts, the lonely CCo of the test should be present
+ in the second AVLN, the lonely station in AVLN1 should be in the
+ Unassociated STA status."""
+ csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
+ csi.process_avln_launch (avln1)
+ csi.sniffer_activate (avln1_stas[0])
+ csi.process_wait_sec (5)
+ own = Station_own_data ()
+ own.get_data (csi.get_maximus (), avln1.get_sta(0).get_sta_cesar())
+ # Test the CCo status of this station.
+ self.failUnless (own.tei == 1)
+ self.failUnless (own.is_cco == True)
+ # Launch the second AVLN.
+ csi.authentication_status (avln1)
+ csi.process_avln_launch (avln2)
+ csi.process_wait_sec (10)
+ # Test station of the first AVLN to be unassociated.
+ own = Station_own_data ()
+ own.get_data (csi.get_maximus (), avln1.get_sta(0).get_sta_cesar())
+ self.failUnless (own.tei == 0)
+ self.failUnless (own.is_cco == False)
+ # The second AVLN must have a CCo.
+ cco = avln2.get_sta (avln2_sta_nb - 1)
+ own = Station_own_data ()
+ own.get_data (csi.get_maximus (), cco.get_sta_cesar())
+ self.failUnless (own.tei == 1)
+ self.failUnless (own.is_cco == True)
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestTwoAVLNS)
+testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+csi.process_avlns_stop ()
+# For nightly build errors
+sys.exit ((1, 0)[testResult.wasSuccessful ()])
+# Killall stations.
+os.system ('killall cco0s2.elf')