summaryrefslogtreecommitdiff
path: root/cesar/test_general
diff options
context:
space:
mode:
authorNélio Laranjeiro2011-11-23 17:04:11 +0100
committerNélio Laranjeiro2011-11-28 17:12:50 +0100
commit44efa59693a34292a713cfbaaa2dacd0c87c3f85 (patch)
tree7cad0d381b6d3f22cf432088c2a353b97d579310 /cesar/test_general
parent47503273b2f07b353b3fe1a3875db301b3042d91 (diff)
cesar: update and move change NMK scenario
Diffstat (limited to 'cesar/test_general')
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc17_change_nmk.py160
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc18_change_nmk_cco_first_and_after_sta.py104
-rw-r--r--cesar/test_general/station/scenario/Makefile4
-rw-r--r--cesar/test_general/station/scenario/py/sc12_change_nmk.py331
4 files changed, 333 insertions, 266 deletions
diff --git a/cesar/test_general/station/cco0/s2/py/sc17_change_nmk.py b/cesar/test_general/station/cco0/s2/py/sc17_change_nmk.py
deleted file mode 100644
index b9550c2571..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc17_change_nmk.py
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-# Copyright (C) 2011 Spidcom
-#
-# Change the Network password from the CCo.
-#
-# All the AVLN change the network password and the traffic works.
-#############################################################################
-
-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 *
-from own_data import Schedules
-from maximus.mme import *
-from struct import pack, unpack
-from csipacket import csiPacket
-from csifilter import frame_filter_msdu_mme
-
-csi = csiCore (1234)
-
-NPWs = ["HomePlugAV0123", "SPIDCOMTEST012"]
-nb_stas = 3
-
-# Creating an AVLN.
-avln = csi.avln_add (NPWs[0], "AVLN")
-
-# Create the stations.
-stas = []
-for i in range (1, nb_stas + 1):
- stas.append (avln.sta_add ("00:13:d7:00:00:%02x" % i, False, False,
- "HomePlug_AVLN1_Station%d" % i, "spc300_sta%d" % i, "station%d" % i,
- 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 (avln)
-
-def drv_sta_set_key (sta):
- """Send and receive a DRV_STA_SET_KEY.REQ and analyse the confirmation
- from the station."""
- print "Sending the MME to station with mac address ", sta.get_mac_addr()
- # Prepare the MME to change the key.
- entry = "0000000011111111"
- for i in range (44):
- entry += pack ('<B', 0)
- mmheader = MMHeader(ODA=sta.get_mac_addr (),
- OSA="00:00:00:00:00:00", MMV=0x01,
- MMTYPE = 0xb040)
- mme = MME(MMHeader=mmheader, MMEntry=entry)
- rsp = mme.sendnrecv(maximus=csi.get_maximus(),
- station=sta.get_sta_cesar(), filter=frame_filter_msdu_mme)
- if len (rsp) == 1:
- result = unpack ('B', rsp.pop().get_mmentry()[0])[0]
- return result == 0
- return False
-
-def get_cco (stalist):
- """Get the CCo in the station list."""
- own = Station_own_data ()
- for i in stalist:
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), i.get_sta_cesar())
- if own.is_cco:
- cco = i
- break
- return cco
-
-class TestNPWChange(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def change_nmk (self, sta):
- """Change the NMK on the CCo."""
- self.failUnless (drv_sta_set_key (sta))
- csi.process_wait_sec (5)
-
- def testCCoChangeNPW (self):
- """Change the network password of the AVLN by the CCo"""
- self.new_avln = list()
- cco = get_cco (stas)
- self.change_nmk (cco)
- # At this moment the CCo is no more a CCo, it is a USTA. The new CCo
- # has taken the CCo role and maintain the AVLN alive.
- packets = []
- for i in stas:
- if i != cco:
- packets.append (csiPacket (1000, avln, cco, sta_dest = i))
- csi.process_data_send_traffic (packets)
- csi.process_wait_sec (1)
- csi.process_verify_transmission ()
- self.failUnless (csi.process_end_get_result () == False)
- # The other two stations should be able to communicate.
- csi.transmission_result_reset ()
- packets = []
- packets.append (csiPacket (1000, avln, stas[0], sta_dest = stas[1]))
- packets.append (csiPacket (1000, avln, stas[1], sta_dest = stas[0]))
- csi.process_data_send_traffic (packets)
- csi.process_wait_sec (1)
- csi.process_verify_transmission ()
- self.failUnless (csi.process_end_get_result ())
- self.new_avln.append (cco)
-
- # Still not ended !!!
- cco = get_cco (stas)
- self.change_nmk (cco)
- self.new_avln.append (cco)
- # Wait 10 seconds to allow the new two stations to form the new AVLN.
- csi.process_wait_sec (10)
- csi.transmission_result_reset ()
- packet = csiPacket (1000, avln, self.new_avln[1],
- sta_dest = self.new_avln[0])
- csi.process_data_send (packet)
- csi.process_wait_sec (1)
- packet = csiPacket (1000, avln, self.new_avln[0],
- sta_dest = self.new_avln[1])
- csi.process_data_send (packet)
- csi.process_wait_sec (1)
- csi.process_verify_transmission ()
- self.failUnless (csi.process_end_get_result ())
-
- # Last step, change the NMK on the last station.
- sta = None
- for i in stas:
- if not self.new_avln.count (i):
- sta = i
- break
- self.change_nmk (sta)
- # Wait 10 seconds to allow the new two stations to form the new AVLN.
- csi.process_wait_association ()
- csi.process_wait_authentication ()
- csi.authentication_status (avln)
- packets = list()
- for i in stas:
- for j in stas:
- if i != j:
- packets.append (csiPacket (1000, avln, i, sta_dest = j))
- csi.process_data_send_traffic (packets)
- csi.process_wait_sec (1)
- csi.process_verify_transmission ()
- self.failUnless (csi.process_end_get_result () == True)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestNPWChange)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-# For nightly build errors
-csi.process_avlns_remove ()
-csi.process_uninit ()
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc18_change_nmk_cco_first_and_after_sta.py b/cesar/test_general/station/cco0/s2/py/sc18_change_nmk_cco_first_and_after_sta.py
deleted file mode 100644
index c80485c7bf..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc18_change_nmk_cco_first_and_after_sta.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-# Copyright (C) 2011 Spidcom
-#
-# Change the Network password from the CCo.
-#############################################################################
-
-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 *
-from own_data import Schedules
-from maximus.mme import *
-from struct import pack, unpack
-from csipacket import csiPacket
-from csifilter import frame_filter_msdu_mme
-
-csi = csiCore (1234)
-
-NPWs = ["HomePlugAV0123", "SPIDCOMTEST012"]
-nb_stas = 2
-
-# Creating an AVLN.
-avln = csi.avln_add (NPWs[0], "AVLN")
-
-# Create the stations.
-stas = []
-for i in range (1, nb_stas + 1):
- stas.append (avln.sta_add ("00:13:d7:00:00:%02x" % i, False, False,
- "HomePlug_AVLN1_Station%d" % i, "spc300_sta%d" % i, "station%d" % i,
- 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 (avln)
-
-def drv_sta_set_key (sta):
- """Send and receive a DRV_STA_SET_KEY.REQ and analyse the confirmation
- from the station."""
- print "Sending the MME to station with mac address ", sta.get_mac_addr()
- # Prepare the MME to change the key.
- entry = "0000000011111111"
- for i in range (44):
- entry += pack ('<B', 0)
- mmheader = MMHeader(ODA=sta.get_mac_addr (),
- OSA="00:00:00:00:00:00", MMV=0x01,
- MMTYPE = 0xb040)
- mme = MME(MMHeader=mmheader, MMEntry=entry)
- rsp = mme.sendnrecv(maximus=csi.get_maximus(),
- station=sta.get_sta_cesar(), filter=frame_filter_msdu_mme)
- if len (rsp) == 1:
- result = unpack ('B', rsp.pop().get_mmentry()[0])[0]
- return result == 0
- return False
-
-def get_cco (stalist):
- """Get the CCo in the station list."""
- own = Station_own_data ()
- for i in stalist:
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), i.get_sta_cesar())
- if own.is_cco:
- cco = i
- break
- return cco
-
-class TestNPWChange(unittest.TestCase):
- """Change the network password on the CCo and after on the STA, the AVLN
- should be reformed."""
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def change_nmk (self, sta):
- """Change the NMK on the CCo."""
- self.failUnless (drv_sta_set_key (sta))
- csi.process_wait_sec (2)
-
- def testCCoChangeNPW (self):
- """Change the network password of the AVLN by the CCo"""
- self.change_nmk (stas[1])
- self.change_nmk (stas[0])
- # Wait 10 seconds to allow the new two stations to form the new AVLN.
- csi.process_wait_association ()
- csi.process_wait_authentication ()
- csi.authentication_status (avln)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestNPWChange)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-# For nightly build errors
-csi.process_avlns_remove ()
-csi.process_uninit ()
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/Makefile b/cesar/test_general/station/scenario/Makefile
index 975d2af0ad..952e5a3d3e 100644
--- a/cesar/test_general/station/scenario/Makefile
+++ b/cesar/test_general/station/scenario/Makefile
@@ -16,8 +16,8 @@ testbook: py/sc01_assoc_auth.py py/sc02_stas_communication.py \
py/sc05_cc_leave.py py/sc06_discover_procedure.py \
py/sc07_bridge.py py/sc08_bentry_change.py \
py/sc09_simple_connect.py py/sc10_short_messages.py \
- py/sc11_cm_nw_info.py \
- py/sc13_data_rate.py py/sc14_igmp.py py/sc15_change_nmk.py
+ py/sc11_cm_nw_info.py py/sc12_change_nmk.py \
+ py/sc13_data_rate.py py/sc14_igmp.py
python testbook.py $^ > $@.rst
CLEAN_FILES += testbook.rst
diff --git a/cesar/test_general/station/scenario/py/sc12_change_nmk.py b/cesar/test_general/station/scenario/py/sc12_change_nmk.py
new file mode 100644
index 0000000000..636eb73629
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc12_change_nmk.py
@@ -0,0 +1,331 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+from handover_protocol import HPAVHandoverProtocol
+from association_protocol import HPAVAssocAuthProtocol
+
+def staGetSnidAndNid (sta, maximus):
+ """Get the NID and the SNID of a station."""
+ sta_data = Station_own_data ()
+ data = sta_data.get_data (maximus, sta.get_sta_cesar ())
+ return [data.nid, data.snid]
+
+def prepare_packets (avln, cco, stas):
+ """ """
+ packets = list ()
+ for i in stas:
+ packets.append (csiPacket (payload_size = 200, avln = avln,
+ sta_src = i, sta_dest = cco))
+ packets.append (csiPacket (payload_size = 200, avln = avln,
+ sta_src = cco, sta_dest = i))
+ for j in stas:
+ if i is not j:
+ packets.append (csiPacket (payload_size = 200, avln = avln,
+ sta_src = i, sta_dest = j))
+ return packets
+
+class testAVLN:
+ """Define the AVLN with a CCo and a list of stations."""
+
+ def __init__ (self):
+ self.cco = None
+ self.stas = None
+
+class TestNMK (unittest.TestCase):
+ """Change the Network password on station in an AVLN."""
+
+ def setUp (self):
+ pass
+
+ def tearDown (self):
+ pass
+
+ def init (self, avln_station_array):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.csi.init_test_bed (avln_station_array)
+ self.maximus = self.csi.get_maximus ()
+ self.avlns = list ()
+ global NMK
+ NMK = random.getrandbits(64)
+
+ def uninit (self):
+ del self.maximus
+ self.csi.uninit_test_bed ()
+ self.csi.process_uninit ()
+ del self.csi
+
+ def changeNMK (self, sta, nmk):
+ """Change the NMK on the station."""
+ mme = Ether (dst = sta.get_mac_addr (), src = MAC_DEFAULT) \
+ / scammer.MME () \
+ / scammer.DRV_STA_SET_KEY_REQ (nmk = nmk, type = 1)
+ rsp = sendnrecv_mme (self.csi.get_maximus (), sta, mme)
+ self.failUnless (rsp)
+ mme_cnf = Ether (rsp[0].get ())
+ self.failUnless (mme_cnf.result == 0)
+
+ def t3StaStep1 (self):
+ """ step1: Change the NMK on the CCo of the AVLN.
+ The CCo should do a handover to one of the other stations and
+ become STA before leaving the AVLN.
+ At the end we have two AVLNS:
+
+ - one with a CCo and a STA (AVLN1).
+ - the other one with an unassociated STA (AVLN2).
+ """
+ print "First step"
+ cco = self.avlns[0].cco
+ sta = self.avlns[0].stas[1]
+ # Macs
+ cco_mac = cco.get_mac_addr ()
+ sta_mac = sta.get_mac_addr ()
+ # Get the nid.
+ nid, snid = staGetSnidAndNid (cco, self.maximus)
+ # Change the NMK on the CCo.
+ status = sniffer (self.maximus, cco, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ self.changeNMK (cco, NMK)
+ self.csi.process_wait_sec (5)
+ status = sniffer (self.maximus, cco)
+ self.failUnless (status)
+ # We need the new NID of the CCo to check the CM_UNASSOCIATED_STA.IND.
+ nid_new, snid_new = staGetSnidAndNid (cco, self.maximus)
+ # Get the sniffed MME to process.
+ protocol = HPAVProtocol ()
+ protocol.add_mme_rx (cco_mac, MAC_DEFAULT,
+ scammer.DRV_STA_SET_KEY_REQ (nmk = NMK, type = 1))
+ protocol.add_mme_tx (MAC_DEFAULT, cco_mac,
+ scammer.DRV_STA_SET_KEY_CNF (result = 0))
+ handover_station_list = [
+ scammer.CC_HANDOVER_INFO_IND_sta_info (tei = 1,
+ mac = cco_mac, status = 1),
+ scammer.CC_HANDOVER_INFO_IND_sta_info (tei = 2,
+ mac = self.avlns[0].stas[0].get_mac_addr (),
+ status = 1)
+ ]
+ teimap_station_list = [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 1, mac = cco_mac,
+ status = 1),
+ ]
+ HPAVHandoverProtocol (protocol, sta_mac, cco_mac,
+ handover_station_list, teimap_station_list)
+ protocol.add_mme_tx (MAC_DEFAULT, cco_mac,
+ scammer.CM_UNASSOCIATED_STA_IND (nid = nid_new, cco_cap = 0))
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ self.csi.reset_sniffed_packets ()
+ # Keep the CCo as USTA in the class.
+ av = testAVLN ()
+ av.stas = [cco]
+ self.avlns.append (av)
+ # Update the current AVLN.
+ self.avlns[0].cco = sta
+ self.avlns[0].stas.remove (sta)
+ # We can test some communication.
+ avln = self.csi.avln_get (0)
+ packets = prepare_packets (avln, self.avlns[0].cco, self.avlns[0].stas)
+ result = send_check_datas (self.csi, avln, packets)
+ self.failUnless (result)
+
+ def t3StaStep2 (self):
+ """ step2: Change the NMK on the CCo.
+ The CCo should do a handover to one of the other stations and
+ become STA before leaving the AVLN.
+
+ At the end we have two AVLNS:
+ - AVLN1 with a CCo and a STA.
+ - AVLN2 with a USTA.
+ """
+ print "Second step"
+ cco = self.avlns[0].cco
+ sta = self.avlns[0].stas[0]
+ cco_mac = cco.get_mac_addr ()
+ sta_mac = sta.get_mac_addr ()
+ # Get the nid.
+ nid, snid = staGetSnidAndNid (cco, self.maximus)
+ # Change the NMK on the CCo.
+ status = sniffer (self.maximus, cco, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ self.changeNMK (cco, NMK)
+ self.csi.process_wait_sec (15)
+ status = sniffer (self.maximus, cco)
+ self.failUnless (status)
+ # Get the new nid of the old CCo.
+ nid_new, snid_new = staGetSnidAndNid (cco, self.maximus)
+ # Check the protocol.
+ protocol = HPAVProtocol ()
+ protocol.add_mme_rx (cco_mac, MAC_DEFAULT,
+ scammer.DRV_STA_SET_KEY_REQ (nmk = NMK, type = 1))
+ protocol.add_mme_tx (MAC_DEFAULT, cco_mac,
+ scammer.DRV_STA_SET_KEY_CNF (result = 0))
+ handover_station_list = [
+ scammer.CC_HANDOVER_INFO_IND_sta_info (tei = 3,
+ mac = cco_mac, status = 1),
+ ]
+ teimap_station_list = [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 3,
+ mac = cco_mac, status = 1),
+ ]
+ HPAVHandoverProtocol (protocol, sta_mac, cco_mac,
+ handover_station_list, teimap_station_list)
+ protocol.add_mme_tx (MAC_DEFAULT, cco_mac,
+ scammer.CM_UNASSOCIATED_STA_IND (nid = nid_new, cco_cap = 0),
+ 2)
+ # From here, the station on the one the NMK have just been changed
+ # will try to associate with the previous CCo of step 1.
+ avln = self.avlns[1]
+ avln.cco = avln.stas.pop ()
+ avln.stas = [cco]
+ avln = self.avlns[0]
+ avln.cco = None
+ # Prepare protocol.
+ avln2cco = self.avlns[1].cco
+ avln2cco_mac = avln2cco.get_mac_addr ()
+ avln2sta = self.avlns[1].stas[0]
+ avln2sta_mac = avln2sta.get_mac_addr ()
+ HPAVAssocAuthProtocol (protocol, avln2cco_mac, avln2sta_mac, nid_new,
+ snid_new,
+ [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 1,
+ mac = avln2cco_mac, status = 1),
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 2,
+ mac = avln2sta_mac, status = 0),
+ ], 0)
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ self.csi.reset_sniffed_packets ()
+ # If we send data from station to the CCo it must be received.
+ # Do not change the way.
+ avln = self.csi.avln_get (0)
+ packets = [
+ csiPacket (payload_size = 200, avln = avln,
+ sta_src = avln2sta, sta_dest = avln2sta),
+ csiPacket (payload_size = 200, avln = avln,
+ sta_src = avln2cco, sta_dest = avln2sta),
+ ]
+ result = send_check_datas (self.csi, avln, packets)
+ self.failUnless (result)
+
+ def t3StaStep3 (self):
+ """step3: Change the NMK on the USTA. At the end we should have a
+ single AVLN with 3 stations associated and authenticated (one of those
+ is the CCo).
+ """
+ cco = self.avlns[1].cco
+ sta = self.avlns[0].stas.pop ()
+ # Change the NMK on the CCo.
+ status = sniffer (self.maximus, sta, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ self.changeNMK (sta, NMK)
+ self.csi.process_wait_association ()
+ self.csi.process_wait_authentication ()
+ status = sniffer (self.maximus, sta)
+ self.failUnless (status)
+ # Prepare macs.
+ nid, snid = staGetSnidAndNid (cco, self.maximus)
+ cco_mac = cco.get_mac_addr ()
+ sta_mac = sta.get_mac_addr ()
+ protocol = HPAVProtocol ()
+ HPAVAssocAuthProtocol (protocol, cco_mac, sta_mac, nid, snid,
+ [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 1,
+ mac = cco_mac, status = 1),
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 2,
+ mac = sta_mac, status = 1),
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 3,
+ mac = sta_mac, status = 0),
+ ], 0)
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ self.csi.reset_sniffed_packets ()
+ # Check transmission.
+ avln = self.csi.avln_get (0)
+ cco = avln.get_cco (self.maximus)
+ stas = avln.get_stas (self.maximus)
+ packets = prepare_packets (avln, cco, stas)
+ result = send_check_datas (self.csi, avln, packets)
+ self.failUnless (result)
+
+ def test3STA (self):
+ """
+ init: 3 stations associated authenticated on the same AVLN.
+
+ step1: Change the NMK on the CCo of the AVLN.
+ The CCo should do a handover to one of the other stations and
+ become STA before leaving the AVLN.
+ At the end we have two AVLNS:
+
+ - one with a CCo and a STA (AVLN1).
+ - the other one with an unassociated STA (AVLN2).
+
+ step2: Change the NMK on the CCo.
+ The CCo should do a handover to one of the other stations and
+ become STA before leaving the AVLN.
+
+ At the end we have two AVLNS:
+ - AVLN1 with a CCo and a STA.
+ - AVLN2 with a USTA.
+
+ step3: Change the NMK on the USTA. At the end we should have a single
+ AVLN with 3 stations associated and authenticated (one of those is the
+ CCo).
+ """
+ self.init ([3])
+ avln = testAVLN ()
+ avln.cco = self.csi.avln_get (0).get_cco (self.maximus)
+ avln.stas = self.csi.avln_get (0).get_stas (self.maximus)
+ self.avlns.append (avln)
+ self.t3StaStep1 ()
+ self.t3StaStep2 ()
+ self.t3StaStep3 ()
+ del self.avlns
+ self.uninit ()
+
+ def testChangeNMKOnCCoAndSTA (self):
+ """Change the NMK on the CCo and just after on the station.
+ """
+ self.init ([2])
+ cco = self.csi.avln_get (0).get_cco (self.maximus)
+ sta = self.csi.avln_get (0).get_stas (self.maximus)[0]
+ # Change the NMK on the CCo.
+ status = sniffer (self.maximus, cco, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ self.changeNMK (cco, NMK)
+ self.changeNMK (sta, NMK)
+ self.csi.process_wait_association ()
+ self.csi.process_wait_authentication ()
+ status = sniffer (self.maximus, cco)
+ self.failUnless (status)
+ nid, snid = staGetSnidAndNid (cco, self.maximus)
+ cco_mac = cco.get_mac_addr ()
+ sta_mac = sta.get_mac_addr ()
+ protocol = HPAVProtocol ()
+ HPAVAssocAuthProtocol (protocol, cco_mac, sta_mac, nid, snid,
+ [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 1,
+ mac = cco_mac, status = 1),
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 2,
+ mac = sta_mac, status = 0),
+ ], 0)
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ self.csi.reset_sniffed_packets ()
+ # Check transmission.
+ avln = self.csi.avln_get (0)
+ stas = avln.get_stas (self.maximus)
+ packets = prepare_packets (avln, cco, stas)
+ result = send_check_datas (self.csi, avln, packets)
+ self.failUnless (result)
+ self.uninit ()
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestNMK)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])