From 2a9bdbe067b50341cb9867fbe17bc0895dc5b41e Mon Sep 17 00:00:00 2001 From: laranjeiro Date: Thu, 29 Jul 2010 13:23:15 +0000 Subject: cesar/test_general/station/cco0/s2: fix snid change script (scenario 4) git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7334 017c9cb6-072f-447c-8318-d5b54f68fe89 --- .../station/cco0/s2/py/sc04_change_snid.py | 42 ++++++++++------------ 1 file changed, 18 insertions(+), 24 deletions(-) (limited to 'cesar/test_general') diff --git a/cesar/test_general/station/cco0/s2/py/sc04_change_snid.py b/cesar/test_general/station/cco0/s2/py/sc04_change_snid.py index ff684e3049..3b1b4f654d 100644 --- a/cesar/test_general/station/cco0/s2/py/sc04_change_snid.py +++ b/cesar/test_general/station/cco0/s2/py/sc04_change_snid.py @@ -14,37 +14,36 @@ from csicore import * from beacon import * csi = csiCore (1234) - +MACSDEFAULT = "00:13:d7:00:0%x:%02x" # Creating an AVLN. avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1") - -sta1_debug = False -sta2_debug = False - +avln1_sta_nb = 2 # Adding the stations. -stas = list () -stas.append (avln1.sta_add ("00:00:00:00:01:01", False, False, - "HomePlug_AVLN1_Station1", "spc300_sta1", "station1", 1, sta1_debug)) -stas.append (avln1.sta_add ("00:00:00:00:01:02", False, False, - "HomePlug_AVLN1_Station2", "spc300_sta2", "station2", 1, sta2_debug)) +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/cco0s2.elf']) csi.process_avlns_launch () csi.process_wait_association (15) csi.process_wait_authentication (15) csi.authentication_status (avln1) - +# Get the CCo. +cco = avln1_stas[avln1_sta_nb - 1] own = Station_own_data () -own.get_data (csi.get_maximus (), stas[0].get_sta_cesar()) +own.get_data (csi.get_maximus (), cco.get_sta_cesar()) snid = own.snid own = None # Activate the sniffer for the beacon TX on the CCo. -state = csi.sniffer_activate (stas[0], False, False, True, False) +state = csi.sniffer_activate (cco, False, False, True, False) if state == False: print "Sniffer not activated for Sta 1" fcall = csi.get_maximus().create_fcall ("fc_cco_change_snid") -fcall.set_sta (stas[0].get_sta_cesar().get()) +fcall.set_sta (cco.get_sta_cesar().get()) fcall.add_param_ushort ('snid', snid + 1) fcall.send() @@ -67,24 +66,19 @@ class TestSnidChange(unittest.TestCase): def test (self): - self.failUnless (beacon != None) + self.failUnless (beacon) unpack = Beacon () unpack.unpack (beacon[0].get()) self.failUnless (unpack.change_snid_snid == snid + 1) unpack = None - self.failUnless (beacon2 != None) unpack = Beacon() unpack.unpack (beacon2[0].get()) self.failUnless (unpack.change_snid_snid == 0) - - own = Station_own_data () - own.get_data (csi.get_maximus (), stas[0].get_sta_cesar()) - self.failUnless (own.snid == snid + 1) - - own = Station_own_data () - own.get_data (csi.get_maximus (), stas[1].get_sta_cesar()) - self.failUnless (own.snid == snid + 1) + for i in avln1_stas: + own = Station_own_data () + own.get_data (csi.get_maximus (), i.get_sta_cesar()) + self.failUnless (own.snid == snid + 1) suite = unittest.TestLoader().loadTestsFromTestCase(TestSnidChange) testResult = unittest.TextTestRunner(verbosity=2).run(suite) -- cgit v1.2.3