summaryrefslogtreecommitdiff
path: root/cesar/test_general
diff options
context:
space:
mode:
authorlaranjeiro2010-07-06 10:12:08 +0000
committerlaranjeiro2010-07-06 10:12:08 +0000
commita23cfac9536cdc570343efd23d40d79345e59ecb (patch)
tree48c01564cc54124aaf9df29090a0e6483f8d76e3 /cesar/test_general
parent48528032239c2007428059721e305ca2974dcf87 (diff)
cesar/cp/{beacon, sta/mgr}: change snid conflict detection, closes #1695
Previously the sta_mgr was checking the snid conflict, this was causing the CCo to continuously change the SNID (even after a SNID countdown beacon entry). Now CP beacon is responsible to detect it and inform the CCo action module, It only posts the event if now snid countdown is currently done. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7266 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/test_general')
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc06_snid_conflict.py114
1 files changed, 32 insertions, 82 deletions
diff --git a/cesar/test_general/station/cco0/s2/py/sc06_snid_conflict.py b/cesar/test_general/station/cco0/s2/py/sc06_snid_conflict.py
index d7246f14aa..13b7698c8a 100644
--- a/cesar/test_general/station/cco0/s2/py/sc06_snid_conflict.py
+++ b/cesar/test_general/station/cco0/s2/py/sc06_snid_conflict.py
@@ -15,32 +15,29 @@ from beacon import *
csi = csiCore (1234)
+MACSDEFAULT = "00:13:d7:00:0%x:%02x"
+
# Creating an AVLN.
avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-avln2 = csi.avln_add ("Homeplug_AVLN2", "AVLN2")
+avln1_sta_nb = 2
-avln1_sta1_debug = False
-avln1_sta2_debug = False
-
-avln2_sta1_debug = False
-avln2_sta2_debug = False
+avln2 = csi.avln_add ("Homeplug_AVLN2", "AVLN2")
+avln2_sta_nb = 2
# Adding the stations.
avln1_stas = list ()
-avln1_stas.append (avln1.sta_add ("00:00:00:00:01:01", False, False,
- "HomePlug_AVLN1_Station1", "av1_spc300_sta1", "avln1_station1", 1,
- avln1_sta1_debug))
-avln1_stas.append (avln1.sta_add ("00:00:00:00:01:02", False, False,
- "HomePlug_AVLN1_Station2", "av1_spc300_sta2", "avln1_station2", 1,
- avln1_sta2_debug))
+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_stas = list ()
-avln2_stas.append (avln2.sta_add ("00:00:00:00:02:01", False, False,
- "HomePlug_AVLN2_Station1", "av2_spc300_sta1", "avln2_station1", 1,
- avln2_sta1_debug))
-avln2_stas.append (avln2.sta_add ("00:00:00:00:02:02", False, False,
- "HomePlug_AVLN2_Station2", "av2_spc300_sta2", "avln2_station2", 1,
- avln2_sta2_debug))
+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))
csi.process_init (sys.argv + ['-e' , 'obj/cco0s2.elf'])
csi.process_avlns_launch ()
@@ -62,99 +59,52 @@ class TestSnidChange(unittest.TestCase):
pass
def testSnidDiff (self):
- print ""
-
+ """Set the same SNID in the AVLN using Fcalls, CCo should change the
+ SNID."""
# Get the snid of the first AVLN.
own = Station_own_data ()
own.get_data (csi.get_maximus (), avln1_stas[1].get_sta_cesar())
avln1_snid = own.snid
own = None
- print "AVLN 1 SNID : ", avln1_snid
-
- # Get the snid of the second AVLN.
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), avln2_stas[1].get_sta_cesar())
- avln2_snid = own.snid
- own = None
- print "AVLN 2 SNID : ", avln2_snid
-
- # Activate the sniffer for the beacon TX on the CCo of the first AVLN.
- state = csi.sniffer_activate (avln1_stas[1], False, False, True, False)
- if state == False:
- print "Sniffer not activated for AVLN 1 Sta 2"
-
- fcall = csi.get_maximus().create_fcall ("fc_cco_change_snid")
- fcall.set_sta (avln1_stas[1].get_sta_cesar().get())
- fcall.add_param_ushort ('snid', avln1_snid + 1)
- fcall.send()
-
- # Wait 1 seconds.
- csi.process_wait_sec (1)
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), avln1_stas[1].get_sta_cesar())
- avln1_snid = own.snid
-
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), avln1_stas[0].get_sta_cesar())
- avln2_snid = own.snid
-
- self.failUnless (avln1_snid != avln2_snid)
-
- def testSnideq (self):
print ""
-
- # Get the snid of the first AVLN.
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), avln1_stas[1].get_sta_cesar())
- avln1_snid = own.snid
- own = None
print "AVLN 1 SNID : ", avln1_snid
-
# Get the snid of the second AVLN.
own = Station_own_data ()
own.get_data (csi.get_maximus (), avln2_stas[1].get_sta_cesar())
avln2_snid = own.snid
own = None
print "AVLN 2 SNID : ", avln2_snid
-
fcall = csi.get_maximus().create_fcall ("fc_cco_change_snid")
fcall.set_sta (avln1_stas[1].get_sta_cesar().get())
- fcall.add_param_ushort ('snid', avln2_snid)
+ fcall.add_param_ushort ('snid', avln1_snid + 1)
fcall.send()
-
- beacon = csi.sniff_packets (1)
-
- # Wait 1 seconds.
- csi.process_wait_sec (0.2)
- beacon2 = csi.sniff_packets (1)
-
- self.failUnless (beacon != None)
- unpack = Beacon ()
- unpack.unpack (beacon[0].get())
- self.failUnless (unpack.change_snid_snid == avln2_snid)
- unpack = None
-
- self.failUnless (beacon2 != None)
- unpack = Beacon()
- unpack.unpack (beacon2[0].get())
- self.failUnless (unpack.change_snid_snid == 0)
-
+ csi.process_wait_sec (2)
own = Station_own_data ()
own.get_data (csi.get_maximus (), avln1_stas[1].get_sta_cesar())
avln1_snid = own.snid
print "AVLN 1 SNID : ", avln1_snid
-
own = Station_own_data ()
- own.get_data (csi.get_maximus (), avln2_stas[1].get_sta_cesar())
+ own.get_data (csi.get_maximus (), avln2_stas[0].get_sta_cesar())
avln2_snid = own.snid
print "AVLN 2 SNID : ", avln2_snid
-
self.failUnless (avln1_snid != avln2_snid)
+ # Send data over the two AVLN 1.
+ from csipacket import csiPacket
+ for i in [avln1, avln2]:
+ stationsrc = i.get_sta (0)
+ stationdst = i.get_sta (1)
+ p = csiPacket (1024, i, stationsrc, stationsrc.get_mac_addr (),
+ stationdst)
+ csi.process_data_send (p)
+ csi.process_wait_sec (1)
+ csi.process_verify_transmission ()
suite = unittest.TestLoader().loadTestsFromTestCase(TestSnidChange)
testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+csi.process_avlns_stop ()
csi.process_avlns_remove ()
# For nightly build errors
sys.exit ((1, 0)[testResult.wasSuccessful ()])
+os.system ("killall cco0s2.elf")