summaryrefslogtreecommitdiff
path: root/cesar/test_general/station
diff options
context:
space:
mode:
authorNélio Laranjeiro2011-11-10 09:40:58 +0100
committerNélio Laranjeiro2011-11-28 17:12:35 +0100
commit733316a7669dcd3c7916f145566e843f292ef53b (patch)
treed9445f4bce5665e5f51f65fc7f9d1a7ad96e7db9 /cesar/test_general/station
parentc5e9b235fecce84273d1be16708d471bcd2f6d10 (diff)
cesar: update cco0/s1 scenario 12 and 13 to scenario sc02 stas_communication
Diffstat (limited to 'cesar/test_general/station')
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc10_two_sta_with_snr.py63
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc12_five_stations.py58
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc13_10stations.py73
-rw-r--r--cesar/test_general/station/scenario/Makefile2
-rw-r--r--cesar/test_general/station/scenario/py/sc02_stas_communication.py52
5 files changed, 53 insertions, 195 deletions
diff --git a/cesar/test_general/station/cco0/s1/py/sc10_two_sta_with_snr.py b/cesar/test_general/station/cco0/s1/py/sc10_two_sta_with_snr.py
deleted file mode 100644
index 0c8dbd4d56..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc10_two_sta_with_snr.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Two station with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Two station which starts at the same time, one will become #
-# the CCo the other one shall become an unassociated station. #
-# At this point the station shall try an association with the #
-# CCo. #
-# Hint: The two station have the same NID. #
-##############################################################################
-
-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 = 2
-# 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))
-csi.process_init (sys.argv + ['-e' , 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-print "Association status on AVLN1"
-csi.authentication_status (avln1)
-
-class TestSNR(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def testSNR (self):
- """Add SNR between the station and start a transmission."""
- avln1.add_snr (csi.get_maximus(), 1.0)
- packets = csi.avln_create_traffic (avln1, 10)
- csi.process_data_send_traffic (packets)
- csi.process_wait_sec (10)
- csi.process_verify_transmission ()
- self.failUnless (csi.process_end_get_result ())
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestSNR)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-csi.process_uninit ()
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc12_five_stations.py b/cesar/test_general/station/cco0/s1/py/sc12_five_stations.py
deleted file mode 100644
index 3fe8b6a166..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc12_five_stations.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/python
-# Script interpreted by the CSI Cesar Script Interpreter
-
-import os
-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)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-sta3_debug = False
-sta4_debug = False
-sta5_debug = False
-
-# Adding some station to the AVLN.
-stas = list ()
-stas.append(avln1.sta_add ("10:11:12:13:14:15", False, False,
- "Homeplug_Station1", "spidcom_spc300_sta1", "station1", 1, sta1_debug))
-stas.append(avln1.sta_add ("20:22:22:23:24:25", False, False,
- "Homeplug_Station2", "spidcom_spc300_sta2", "station2", 1, sta2_debug))
-stas.append(avln1.sta_add ("30:33:32:33:34:35", False, False,
- "Homeplug_Station3", "spidcom_spc300_sta3", "station3", 1, sta3_debug))
-stas.append(avln1.sta_add ("40:44:42:43:44:45", False, False,
- "Homeplug_Station4", "spidcom_spc300_sta4", "station4", 1, sta4_debug))
-stas.append(avln1.sta_add ("50:55:52:53:54:55", False, False,
- "Homeplug_Station5", "spidcom_spc300_sta5", "station5", 1, sta5_debug))
-
-packet_list = csi.avln_create_traffic (avln1, 10)
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-csi.process_avlns_send_broadcast_delayed (0.05)
-
-csi.authentication_status (avln1)
-csi.process_data_send_traffic (packet_list)
-
-csi.process_wait_sec (5)
-csi.process_verify_transmission ()
-
-csi.process_wait_sec (1)
-#csi.process_avlns_stop ()
-
-result = csi.process_end_get_result ()
-csi.process_uninit ()
-
-# For nightly build errors
-sys.exit ((1, 0)[result])
diff --git a/cesar/test_general/station/cco0/s1/py/sc13_10stations.py b/cesar/test_general/station/cco0/s1/py/sc13_10stations.py
deleted file mode 100644
index 76ef84c079..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc13_10stations.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-# Script interpreted by the CSI Cesar Script Interpreter
-
-import os
-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)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-sta3_debug = False
-sta4_debug = False
-sta5_debug = False
-sta6_debug = False
-sta7_debug = False
-sta8_debug = False
-sta9_debug = False
-sta10_debug = False
-
-# Adding some station to the AVLN.
-stas = list ()
-stas.append(avln1.sta_add ("10:11:12:13:14:15", False, False, "Homeplug_Station1", "spidcom_spc300_sta1", "station1", 1, sta1_debug, 0))
-stas.append(avln1.sta_add ("20:22:22:23:24:25", False, False, "Homeplug_Station2", "spidcom_spc300_sta2", "station2", 1, sta2_debug, 0))
-stas.append(avln1.sta_add ("30:33:32:33:34:35", False, False, "Homeplug_Station3", "spidcom_spc300_sta3", "station3", 1, sta3_debug, 0))
-stas.append(avln1.sta_add ("40:44:42:43:44:45", False, False, "Homeplug_Station4", "spidcom_spc300_sta4", "station4", 1, sta4_debug, 0))
-stas.append(avln1.sta_add ("50:55:52:53:54:55", False, False, "Homeplug_Station5", "spidcom_spc300_sta5", "station5", 1, sta5_debug, 0))
-stas.append(avln1.sta_add ("60:66:62:63:64:65", False, False, "Homeplug_Station6", "spidcom_spc300_sta6", "station6", 1, sta6_debug, 0))
-stas.append(avln1.sta_add ("70:77:77:73:74:75", False, False, "Homeplug_Station7", "spidcom_spc300_sta7", "station7", 1, sta7_debug, 0))
-stas.append(avln1.sta_add ("80:88:82:88:84:85", False, False, "Homeplug_Station8", "spidcom_spc800_sta8", "station8", 1, sta8_debug, 0))
-stas.append(avln1.sta_add ("90:99:92:93:99:95", False, False, "Homeplug_Station9", "spidcom_spc300_sta9", "station9", 1, sta9_debug, 0))
-stas.append(avln1.sta_add ("A0:12:13:14:15:16", False, False, "Homeplug_Station10", "spidcom_spc300_sta10", "station10", 1, sta10_debug, 0))
-
-sys.stderr.write("Creating the traffic\n")
-list = csi.avln_create_traffic (avln1, 100)
-
-sys.stderr.write("Launching the test\n")
-csi.process_init (sys.argv + ['-e', 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-
-sys.stderr.write("Wait association\n")
-csi.process_wait_association ()
-sys.stderr.write("Wait authentication\n")
-csi.process_wait_authentication ()
-csi.process_avlns_send_broadcast_delayed (0.001)
-csi.authentication_status (avln1)
-sys.stderr.write("Send traffic\n")
-csi.process_data_send_traffic (list)
-
-sys.stderr.write("Wait 6 seconds in maximus time\n")
-csi.process_wait_sec (6)
-
-print "Verifying the transmission"
-sys.stderr.write("Verifying the transmission\n")
-csi.process_verify_transmission ()
-
-csi.process_wait_sec (1)
-csi.process_avlns_remove()
-
-sys.stderr.write("Ending\n")
-result = csi.process_end_get_result ()
-csi.process_uninit ()
-
-# For nightly build errors
-sys.exit ((1, 0)[result])
diff --git a/cesar/test_general/station/scenario/Makefile b/cesar/test_general/station/scenario/Makefile
index 72ae53f466..9c09b93387 100644
--- a/cesar/test_general/station/scenario/Makefile
+++ b/cesar/test_general/station/scenario/Makefile
@@ -11,7 +11,7 @@ test_scenario_MODULES = lib mac/common mac cl hle interface cp hal station \
include $(BASE)/common/make/top.mk
-testbook: py/sc01_assoc_auth.py
+testbook: py/sc01_assoc_auth.py py/sc02_stas_communication.py
python testbook.py $^ > $@.rst
CLEAN_FILES += testbook.rst
diff --git a/cesar/test_general/station/scenario/py/sc02_stas_communication.py b/cesar/test_general/station/scenario/py/sc02_stas_communication.py
new file mode 100644
index 0000000000..b26c646127
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc02_stas_communication.py
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+
+class TestStationsComm(unittest.TestCase):
+ """Test the communication on an AVLN with or without noise on the
+ channel."""
+
+ def setUp(self):
+ csi = csiCore (1234)
+ csi.process_init (args)
+
+ def tearDown(self):
+ self.csi.process_uninit ()
+ del self.csi
+
+ def testCommunication5Stas (self):
+ """Communication between 5 stations.
+ Send some data between the stations.
+
+ Expected result: Data should be received from each station.
+ """
+ self.csi.init_test_bed ([5])
+ self.failUnless (send_check_datas (self.csi, self.csi.avln_get (0)))
+ self.csi.uninit_test_bed ()
+
+ def testCommunication2StasWithSNR (self):
+ """Communication between 2 stations with Noise on the channel.
+
+ 1. Add noise between each station (value is set to 1.0 in maximus i.e.
+ 100%).
+
+ 2. Send some data between the stations.
+
+ Expected result: Data should be received from each station.
+ """
+ self.csi.init_test_bed ([2])
+ avln = self.csi.avln_get (self.csi.avln_nb() - 1)
+ avln.add_snr (self.csi.get_maximus (), 1.0)
+ self.failUnless (send_check_datas (self.csi, avln))
+ self.csi.uninit_test_bed ()
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestStationsComm)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])