summaryrefslogtreecommitdiff
path: root/cesar/test_general
diff options
context:
space:
mode:
authorlaranjeiro2010-07-28 15:00:30 +0000
committerlaranjeiro2010-07-28 15:00:30 +0000
commitef159d1383e62f2f29bc5e2287f9f022baf63839 (patch)
tree073fde32a3abe616af0e768a311365fd9276b937 /cesar/test_general
parent533fc69ddf13d8ff44343a0d6e74c309a28a023d (diff)
cesar/test_general/station/cco0/s1: fix scenario 4
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7329 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/test_general')
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc4_cc_who_ru.py63
1 files changed, 27 insertions, 36 deletions
diff --git a/cesar/test_general/station/cco0/s1/py/sc4_cc_who_ru.py b/cesar/test_general/station/cco0/s1/py/sc4_cc_who_ru.py
index ba2301c0b7..566cad778c 100644
--- a/cesar/test_general/station/cco0/s1/py/sc4_cc_who_ru.py
+++ b/cesar/test_general/station/cco0/s1/py/sc4_cc_who_ru.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
##############################################################################
-# CC_WHO_ARE_YOU #
+# CC_WHO_ARE_YOU #
# ----------------------------------------------------------------------- #
# #
# Objective: One station which receives the request from the linux and #
@@ -16,64 +16,55 @@ sys.path.append ('../../../../maximus/python/obj/')
sys.path.append ('../../../../maximus/python/')
sys.path.append ('../../../../maximus/python/lib/cesar')
-from maximus.mme.mme import MME
-from maximus.mme.mmheader import MMHeader
-from maximus.mme.mmentry import MMEntry
-from maximus.simu.rx import recv
-from struct import pack, unpack
from csicore import *
-
+MACSDEFAULT = "00:13:d7:00:0%x:%02x"
csi = csiCore (1234)
-
# Creating an AVLN.
-avln = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-
-sta1 = avln.sta_add ("10:11:12:13:14:15", False, False, "Homeplug_Station1",
- "spidcom_spc300_sta1", "station1", 1, sta1_debug)
-sta2 = avln.sta_add ("20:22:22:23:24:25", False, False, "Homeplug_Station2",
- "spidcom_spc300_sta2", "station2", 1, sta2_debug)
-
+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 ()
-def data_msdu_filter (msdu):
- if msdu.get_type () is 'ETHERNET_TYPE_MME':
- # The received object is an MSDU
- return True
- else:
- return False
-
class TestInitFunctions(unittest.TestCase):
def setUp(self):
- pass
+ self.sta = avln1_stas[0]
+ self.cco = avln1_stas[avln1_sta_nb - 1]
def tearDown(self):
pass
def testWhoAreYou(self):
- sta_mac_addr = "10:11:12:13:14:15"
- mme = MME(MMHeader=MMHeader(ODA=sta1.get_mac_addr(),
- OSA=sta1.get_mac_addr(),
+ from maximus.mme.mme import MME
+ from maximus.mme.mmheader import MMHeader
+ from maximus.mme.mmentry import MMEntry
+ from maximus.simu.rx import recv
+ from struct import pack, unpack
+ from csifilter import frame_filter_msdu_mme
+ from csitime import sec_to_tck
+ mme = MME(MMHeader=MMHeader(ODA=self.cco.get_mac_addr(),
+ OSA=self.cco.get_mac_addr(),
MTYPE=0x88E1, MMV=1, MMTYPE=0x002C, FMI=0),
MMEntry=MMEntry(pack ('Q',8910861401412611)))
- mme.send(csi.get_maximus(), sta1.get_sta_cesar().get())
-
- rsp = recv(csi.get_maximus(), count=1, filter=data_msdu_filter,
- timeout = 50000)
+ mme.send(csi.get_maximus(), self.cco.get_sta_cesar().get())
+ rsp = recv(csi.get_maximus(), count=1, filter=frame_filter_msdu_mme,
+ timeout = sec_to_tck (2))
self.failUnless (rsp != None)
if rsp != None:
rsp = rsp[0]
entry = rsp.get_mmentry()
nid = hex(unpack ('Q', entry[0:7] + '\0')[0])
cco_mac = hex(unpack ('Q', entry[7:13] + "\0\0")[0])
- hfid = entry[13:13 + len(avln.get_ahfid())]
+ hfid = entry[13:13 + len(avln1.get_ahfid())]
self.failUnless (nid.lower() == '0x1FA86198795403L'.lower())
- self.failUnless (cco_mac == '0x151413121110L')
- self.failUnless (hfid == avln.get_ahfid())
+ self.failUnless (hfid == avln1.get_ahfid())
suite = unittest.TestLoader().loadTestsFromTestCase(TestInitFunctions)
testResult = unittest.TextTestRunner(verbosity=2).run(suite)