Commit 83a2f8e4d1cf0a32feb89a7ce095071bc4b9af71

Authored by Ginés García
1 parent 7cf3fe8c
Exists in master

Check md5 function added. All methods working correctly. Added a 5 seconds delay…

… before check ping status in sta's
md5sum_check_peers.txt 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  2 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  3 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  4 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  5 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  6 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  7 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  8 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  9 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  10 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  11 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  12 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  13 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  14 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  15 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  16 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  17 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  18 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  19 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  20 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  21 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  22 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  23 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  24 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  25 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  26 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  27 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  28 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
... ...
setup-wlan.py
... ... @@ -71,4 +71,5 @@ if video_nodes > 0:
71 71 for thread in threads:
72 72 t.join()
73 73 print "Configuration process end"
74   -
  74 + # Check if all b43 modules are correctly copied
  75 + #utils_config.check_md5(peers_file_path, ap_addr)
... ...
setup-wlan.py~
... ... @@ -1,74 +0,0 @@
1   -import sys, os.path, threading, time
2   -
3   -# It Includes search_ap_data & configure_ap
4   -import utils_ap
5   -import utils_config
6   -import utils_peers
7   -
8   -# Global Variables
9   -threads = []
10   -
11   -utils_config.check_input_param(str(sys.argv[1]), str(sys.argv[2]), len(sys.argv))
12   -
13   -config_file_path = str(sys.argv[1])
14   -peers_file_path = str(sys.argv[2])
15   -
16   -# Get all the information from json
17   -ap_addr, bssid, rate, mac_ap, power, channel, video_nodes, data_nodes, mechanism = utils_config.get_config_from_json(config_file_path)
18   -# Remove M from rate (Ej: 24M -> 24)
19   -rate = rate[:-1]
20   -b_size = 0
21   -retries = 0
22   -# Check selected mechanism and get extra data if needed
23   -if utils_config.check_mechanism(mechanism) == "not_valid":
24   - print "Mechanism not supported"
25   - sys.exit()
26   -elif mechanism == "UR":
27   - retries = utils_config.get_specific_config(config_file_path,mechanism)
28   -elif mechanism == "BLOCK_ACK":
29   - b_size = utils_config.get_specific_config(config_file_path,mechanism)
30   -
31   -# Setting up AP and peers
32   -if video_nodes > 0:
33   -
34   - # AP configuration
35   - wlan0_ip, mac, wired_ip = utils_ap.search_ap_data(peers_file_path, ap_addr)
36   - if (wlan0_ip == "EMPTY") or (mac == "EMPTY") or (wired_ip == "EMPTY"):
37   - print "No configuration for the AP available on peers file."
38   - sys.exit()
39   - else:
40   - utils_ap.reload_ap(ap_addr)
41   - utils_ap.set_mechanism(ap_addr, mechanism, rate, b_size, retries)
42   - utils_ap.start_ap(ap_addr, wlan0_ip, rate, channel, power)
43   -
44   - # Check ap configuration
45   - ap_status = utils_ap.check_ap(ap_addr, wlan0_ip)
46   - if ap_status != "ok":
47   - print "AP not configured correctly. Problems with %s" % ap_status
48   - sys.exit()
49   - else:
50   - print "AP configured"
51   -
52   - # Peers Configuration
53   - #utils_peers.configure_peers(peers_file_path, ap_addr, bssid, rate, power, channel, mechanism)
54   -
55   - index = 0
56   - with open(peers_file_path) as peers_file_opened:
57   - for peer in peers_file_opened:
58   - peer = peer.split()
59   - peer_ip = peer[0]
60   - peer_mac = peer[1]
61   - peer_ip_wired = peer[2]
62   -
63   - if peer_ip_wired != ap_addr:
64   - index = index+1
65   - thr_name = "thread_%d" % index
66   - t = threading.Thread(target=utils_peers.configure_peer, name=thr_name, args=(peer_ip, peer_ip_wired, bssid, rate, power, channel, mechanism))
67   - threads.append(t)
68   - t.start()
69   - time.sleep(0.005)
70   -
71   - for thread in threads:
72   - t.join()
73   - print "Configuration process end"
74   -
test.txt 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  2 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  3 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  4 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  5 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  6 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  7 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  8 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  9 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  10 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  11 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  12 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  13 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  14 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  15 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  16 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  17 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  18 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  19 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  20 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  21 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  22 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  23 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  24 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  25 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  26 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  27 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
  28 +['c7f83e22d7db67e02cb01468c8dcc3fb /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko\n']
... ...
utils_ap.pyc
No preview for this file type
utils_ap.py~
... ... @@ -1,149 +0,0 @@
1   -import os
2   -import utils_config ## incluse ssh command execution method
3   -
4   -# Global variables
5   -path_module_b43 = "/lib/modules/2.6.36/kernel/drivers/net/wireless"
6   -path_module_80211 = "/lib/modules/2.6.36/kernel/net/mac80211"
7   -path_firm_b43_blockack = "/lib/firmware/b43.video/firmware.blockack"
8   -
9   -# Get ap data from peers file
10   -# - Input: Path to peers file and wired ip where AP is located
11   -# - Output: peer[0] (wlan0 ip - 192.168.98.1), peer[1] (mac address), peer[2] (wired ip - 192.168.97.1)
12   -def search_ap_data(peers_file, ap_addr):
13   - with open(peers_file) as peers_file_opened:
14   - for peer in peers_file_opened:
15   - if ap_addr in peer:
16   - peer = peer.split()
17   - return peer[0], peer[1], peer[2]
18   -
19   - return "EMPTY", "EMPTY", "EMPTY"
20   -
21   -
22   -# Reload all the modules needed by the ap
23   -# - Input: ap_addr
24   -def reload_ap(ap_addr):
25   - print "Reload AP modules using wired ip -> %s" % ap_addr
26   -
27   - hostapd_pids = utils_config.exec_command_ssh(ap_addr, "pgrep -x hostapd")
28   - if hostapd_pids != "ERROR":
29   - for pid in hostapd_pids:
30   - pid = int(pid)
31   - utils_config.exec_command_ssh(ap_addr, ("kill -SIGTERM %d" % pid))
32   - print "Process hostapd (pid = %d) killed" % pid
33   -
34   - print "Reconfiguring Interface ..."
35   - utils_config.exec_command_ssh(ap_addr, "rmmod ath9k && sleep 0.5")
36   - utils_config.exec_command_ssh(ap_addr, "rmmod mac80211")
37   - utils_config.exec_command_ssh(ap_addr, "rmmod b43")
38   -
39   - utils_config.exec_command_ssh(ap_addr, "rm /lib/firmware/b43")
40   - utils_config.exec_command_ssh(ap_addr, ("rm %s/b43/b43.ko" % path_module_b43))
41   - utils_config.exec_command_ssh(ap_addr, ("rm %s/b43" % path_module_b43))
42   - utils_config.exec_command_ssh(ap_addr, ("rm %s/mac80211.ko" % path_module_80211))
43   -
44   - utils_config.exec_command_ssh(ap_addr, ("ln -s %s/mac80211.video.ko %s/mac80211.ko" % (path_module_80211, path_module_80211)))
45   - utils_config.exec_command_ssh(ap_addr, "modprobe mac80211")
46   - utils_config.exec_command_ssh(ap_addr, ("ln -s %s/b43.video %s/b43" % (path_module_b43, path_module_b43)))
47   -
48   -# Enable the required modules according to the selected mechanism
49   -# - Input: AP address, mechanism and rate. In addition b_size or retries if mechanism is BLOCK_ACK or UR
50   -def set_mechanism(ap_addr, mechanism, rate, b_size, retries):
51   - print "Mechanism %s selected for the AP. Loading modules ..." % mechanism
52   -
53   - if mechanism == "BLOCK_ACK":
54   - set_block_ack(ap_addr, rate, b_size)
55   - elif mechanism == "DMS":
56   - set_dms()
57   - elif mechanism == "UR":
58   - set_ur(ap_addr, rate, retries)
59   - elif mechanism == "LEGACY":
60   - set_legacy(ap_addr, rate)
61   -
62   -# Check if all the configuration is correctly set
63   -# - Input: AP address
64   -def check_ap(ap_addr, wlan0_ip):
65   - print "Checking AP ..."
66   - if utils_config.exec_command_ssh(ap_addr, "pgrep -x hostapd") == "ERROR":
67   - return "hostapd"
68   - elif utils_config.exec_command_ssh(ap_addr, "modprobe -l | grep mac80211.ko") == "ERROR":
69   - return "mac80211"
70   - elif utils_config.exec_command_ssh(ap_addr, "modprobe -l | grep b43.ko") == "ERROR":
71   - return "b43"
72   - else:
73   - ap_status = utils_config.check_ping(wlan0_ip)
74   - if ap_status != "ok":
75   - return "ERROR"
76   - else:
77   - return "ok"
78   -
79   -# Load modules in order to enable BLOCK_ACK mechanism
80   -# - Input: AP wired address, rate and b_size
81   -def set_block_ack(ap_addr, rate, b_size):
82   - utils_config.exec_command("cp %s/%s/ucode5.back-%s.fw %s/ucode5.fw" % (path_firm_b43_blockack, rate, b_size, path_firm_b43_blockack))
83   - # DMA
84   - #utils_config.exec_command_ssh(ap_addr, ("cp %s/%s/ucode5.back-%s.fw.dma %s/ucode5.fw" % (path_firm_b43_blockack, rate, b_size, path_firm_b43_blockack)))
85   - utils_config.exec_command_ssh(ap_addr, "cp %s/%s/ucode5.back-%s.fw %s/ucode5.fw" % (path_firm_b43_blockack, rate, b_size, path_firm_b43_blockack))
86   - # END DMA
87   -
88   - utils_config.exec_command_ssh(ap_addr, "ln -s %s /lib/firmware/b43" % path_firm_b43_blockack)
89   - utils_config.exec_command_ssh(ap_addr, "ln -s %s/b43/b43.rate-adaptation.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
90   - #utils_config.exec_command_ssh(ap_addr, "ln -s %s/b43/b43.blockack.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
91   -#PABLO
92   -# ATTENTION: frate=1 implies the transmission rate is fixed, so no rate controller
93   - utils_config.exec_command_ssh(ap_addr, "modprobe b43 qos=1 aseq=1 frate=0 bsize=%s brate=%s && sleep 0.5" % (b_size, rate))
94   -
95   -
96   -# Load modules in order to enable DMS mechanism
97   -# - Input: AP wired address and rate
98   -def set_dms(ap_addr, rate):
99   - utils_config.exec_command_ssh(ap_addr, "ln -s /lib/firmware/b43.video/firmware.dms /lib/firmware/b43")
100   - utils_config.exec_command_ssh(ap_addr, "ln -s %s/b43/b43.dms.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
101   - utils_config.exec_command_ssh(ap_addr, "modprobe b43 qos=0 brate=%s && sleep 0.5" % rate)
102   -
103   -
104   -# Load modules in order to enable UR mechanism
105   -# - Input: AP wired address, rate and retries
106   -def set_ur(ap_addr, rate, retries):
107   - utils_config.exec_command_ssh(ap_addr, "ln -s /lib/firmware/b43.video/firmware.ur /lib/firmware/b43")
108   - utils_config.exec_command_ssh(ap_addr, "rm /lib/firmware/b43.video/firmware.ur/ucode5.fw")
109   - utils_config.exec_command_ssh(ap_addr, "ln -s /lib/firmware/b43.video/firmware.ur/ucode5.ur-%s.fw /lib/firmware/b43/ucode5.fw" % retries)
110   - utils_config.exec_command_ssh(ap_addr, "ln -s %s/b43/b43.ur.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
111   - utils_config.exec_command_ssh(ap_addr, "modprobe b43 qos=1 brate=%s && sleep 0.5" % rate)
112   -
113   -
114   -# Load modules in order to enable LEGACY mechanism
115   -# - Input: AP wired address and rate
116   -def set_legacy(ap_addr, rate):
117   - utils_config.exec_command_ssh(ap_addr, "ln -s /lib/firmware/b43.video/firmware.dms /lib/firmware/b43")
118   - utils_config.exec_command_ssh(ap_addr, "ln -s %s/b43/b43.dms.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
119   - utils_config.exec_command_ssh(ap_addr, "modprobe b43 qos=0 brate=%s && sleep 0.5" % rate)
120   -
121   -# Starts AP with the given configuration and set up wlan0
122   -# - Input: Input: AP address, rate, channel and power that we want to stablish in the AP
123   -def start_ap(ap_addr, wlan0_ip, rate, channel, power):
124   - print "Starting AP on %s with rate = %s, power = %s " % (wlan0_ip, rate, power)
125   - utils_config.exec_command_ssh(ap_addr, "ifconfig wlan0 %s up" % wlan0_ip)
126   - utils_config.exec_command_ssh(ap_addr, "iw reg set JP")
127   -
128   - #print "Running hostapd and setting his configuration and log file"
129   - utils_config.exec_command_ssh(ap_addr, ("cp $PWD/hostapd-minimal-R %s-%s.conf $PWD/hostapd-minimal.conf" % (rate, channel)))
130   - utils_config.exec_command_ssh(ap_addr, "$PWD/hostapd -ddd $PWD/hostapd-minimal.conf > $PWD/hostap.log &")
131   - # utils_config.exec_command_ssh(ap_addr, "hostapd -B /root/hostapd-minimal.conf")
132   -
133   - #print "Configuring Rate and TX Power"
134   - utils_config.exec_command_ssh(ap_addr, ("iwconfig wlan0 rate %s fixed txpower %s fixed" % (rate, power)))
135   -
136   - #print "Configuring multicast route"
137   - utils_config.exec_command_ssh(ap_addr, "route add -host 224.0.0.1 wlan0")
138   -
139   - #print "Setting arp table"
140   - #utils_config.exec_command_ssh(ap_addr, "$PWD/setarp.sh $PATH_AP")
141   -
142   -
143   -
144   -
145   -
146   -
147   -
148   -
149   -
utils_config.py
... ... @@ -78,25 +78,26 @@ def check_mechanism(mechanism):
78 78 else:
79 79 return "valid"
80 80  
81   -
82   -
83   -
84   -
85   -
86   -
87   -
88   -
89   -
90   -
91   -
92   -
93   -
94   -
95   -
96   -
97   -
98   -
99   -
100   -
101   -
102   -
  81 +# Get all the information about b43 module in each sta and write it in a file. Loop on this file in order to try to find differences between sta's checksums
  82 +# - Input: peers file and AP address
  83 +# - Output: Error message if one sta has a different md5check for b45 module
  84 +def check_md5(peers_file_path, ap_addr):
  85 + checks_file = open('test.txt', 'w+')
  86 + with open(peers_file_path) as peers_file_opened:
  87 + for peer in peers_file_opened:
  88 + peer = peer.split()
  89 + peer_ip = peer[0]
  90 + peer_ip_wired = peer[2]
  91 +
  92 + if peer_ip_wired != ap_addr:
  93 + checks_file.write(str(exec_command_ssh(peer_ip_wired, "md5sum /lib/modules/2.6.36/kernel/drivers/net/wireless/b43/b43.ko")))
  94 + checks_file.write('\n')
  95 + checks_file.close()
  96 +
  97 + with open("test.txt") as checkmd5_results:
  98 + for data in checkmd5_results:
  99 + item = data
  100 + for data_buble in checkmd5_results:
  101 + if cmp(item, data_buble) != 0:
  102 + print "One checksum not equal. see test.txt"
  103 + sys.exit()
... ...
utils_config.pyc
No preview for this file type
utils_peers.py
... ... @@ -13,9 +13,9 @@ path_firm_b43_blockack = "/lib/firmware/b43.video/firmware.blockack"
13 13 def configure_peer(peer_ip, peer_ip_wired, bssid, rate, power, channel, mechanism, b_size, retries):
14 14 print threading.currentThread().getName(), "configuring %s" % peer_ip_wired
15 15 reload_peer(peer_ip_wired)
16   - set_mechanism(peer_ip_wired, mechanism)
  16 + set_mechanism(peer_ip_wired, mechanism, rate, b_size, retries)
17 17 start_peer(peer_ip_wired, peer_ip, bssid, rate, power, channel)
18   -
  18 + print "checking %s" % peer_ip_wired
19 19 peer_status = check_peer(peer_ip_wired, peer_ip)
20 20 if peer_status != "ok":
21 21 print threading.currentThread().getName(), "Peer (wired)%s not configured correctly. Problems with %s" % (peer_ip_wired, peer_status)
... ... @@ -30,10 +30,11 @@ def reload_peer(peer_ip_wired):
30 30  
31 31 # kill all wpa supplicants
32 32 wpa_supplicant_pids = utils_config.exec_command_ssh(peer_ip_wired, "pgrep -x wpa_supplicant")
33   - for pid in wpa_supplicant_pids:
34   - pid = int(pid)
35   - utils_config.exec_command_ssh(peer_ip_wired, ("kill -SIGTERM %d" % pid))
36   - #print "Process wpa supplicand (pid = %d) killed" % pid
  33 + if wpa_supplicant_pids != "ERROR":
  34 + for pid in wpa_supplicant_pids:
  35 + pid = int(pid)
  36 + utils_config.exec_command_ssh(peer_ip_wired, ("kill -SIGTERM %d" % pid))
  37 + #print "Process wpa supplicand (pid = %d) killed" % pid
37 38  
38 39 # Reconfigure interface
39 40 #print "Reconfiguring peer %s Interface" % peer_ip_wired
... ... @@ -51,7 +52,7 @@ def reload_peer(peer_ip_wired):
51 52  
52 53 # Enable b43 module using different sources depending of the selected mechanism
53 54 # - Input: Peer address, mechanism
54   -def set_mechanism(peer_ip_wired, mechanism):
  55 +def set_mechanism(peer_ip_wired, mechanism, rate, b_size, retries):
55 56 #print "Mechanism %s selected for the peer" % mechanism
56 57  
57 58 if mechanism == "BLOCK_ACK":
... ... @@ -72,10 +73,10 @@ def check_peer(peer_ip_wired, peer_ip):
72 73 elif utils_config.exec_command_ssh(peer_ip_wired, "modprobe -l | grep b43.ko") == "ERROR":
73 74 return "b43"
74 75 else:
75   - time.sleep(0.5)
  76 + time.sleep(5)
76 77 peer_status = utils_config.check_ping(peer_ip)
77 78 if peer_status != "ok":
78   - return "ERROR"
  79 + return "ping"
79 80 else:
80 81 return "ok"
81 82  
... ... @@ -93,9 +94,9 @@ def set_block_ack(peer_ip_wired, rate, b_size):
93 94 # Load modules in order to enable DMS mechanism
94 95 # - Input: Peer ip wired address and rate
95 96 def set_dms(peer_ip_wired, rate):
96   - utils_config.exec_command_ssh(peer_ip_wired "ln -s /lib/firmware/b43.video/firmware.dms /lib/firmware/b43")
97   - utils_config.exec_command_ssh(peer_ip_wired "rm /lib/firmware/b43/ucode5.fw")
98   - utils_config.exec_command_ssh(peer_ip_wired "ln -s /lib/firmware/b43/ucode5.orig.fw /lib/firmware/b43/ucode5.fw")
  97 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s /lib/firmware/b43.video/firmware.dms /lib/firmware/b43")
  98 + utils_config.exec_command_ssh(peer_ip_wired, "rm /lib/firmware/b43/ucode5.fw")
  99 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s /lib/firmware/b43/ucode5.orig.fw /lib/firmware/b43/ucode5.fw")
99 100  
100 101 utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43/b43.dms.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
101 102 utils_config.exec_command_ssh(peer_ip_wired, "modprobe b43 qos=0 brate=%s && sleep 1" % rate)
... ... @@ -132,4 +133,4 @@ def start_peer(peer_ip_wired, peer_ip, bssid, rate, power, channel):
132 133 utils_config.exec_command_ssh(peer_ip_wired, "route add -host 224.0.0.1 wlan0")
133 134  
134 135 #print "Setting arp table"
135   - #utils_config.exec_command_ssh(peer_ip_wired, "/root/setarp.sh 192.168.98.10")
136 136 \ No newline at end of file
  137 + #utils_config.exec_command_ssh(peer_ip_wired, "/root/setarp.sh 192.168.98.10")
... ...
utils_peers.pyc
No preview for this file type
utils_peers.py~
... ... @@ -1,108 +0,0 @@
1   -import threading
2   -import utils_config
3   -import os, sys, time, re, subprocess
4   -
5   -# Global variables
6   -path_module_b43 = "/lib/modules/2.6.36/kernel/drivers/net/wireless"
7   -path_module_80211 = "/lib/modules/2.6.36/kernel/net/mac80211"
8   -path_firm_b43_blockack = "/lib/firmware/b43.video/firmware.blockack"
9   -
10   -# Run method executed by threads in order to configure one peer
11   -# - Input: peer_ip, peer_ip_wired, bssid, rate, power, channel
12   -# - Configure interfaces, load modules based on the selected mechanism, start peer and check it's configuration
13   -def configure_peer(peer_ip, peer_ip_wired, bssid, rate, power, channel, mechanism, b_size, retries):
14   - print threading.currentThread().getName(), "configuring %s" % peer_ip_wired
15   - reload_peer(peer_ip_wired)
16   - set_mechanism(peer_ip_wired, mechanism)
17   - start_ap(peer_ip_wired, peer_ip, bssid, rate, power, channel)
18   -
19   - peer_status = check_peer(peer_ip_wired, peer_ip)
20   - if peer_status != "ok":
21   - print threading.currentThread().getName(), "Peer (wired)%s not configured correctly. Problems with %s" % (peer_ip_wired, peer_status)
22   - sys.exit()
23   - else:
24   - print "Peer configured - wired = %s, wlan0 = %s" % (peer_ip_wired, peer_ip)
25   -
26   -
27   -# Reconfigure peer interface and enable mac80211 module
28   -# - Input: peer ip wired
29   -def reload_peer(peer_ip_wired):
30   -
31   - # kill all wpa supplicants
32   - wpa_supplicant_pids = utils_config.exec_command_ssh(peer_ip_wired, "pgrep -x wpa_supplicant")
33   - for pid in wpa_supplicant_pids:
34   - pid = int(pid)
35   - utils_config.exec_command_ssh(peer_ip_wired, ("kill -SIGTERM %d" % pid))
36   - #print "Process wpa supplicand (pid = %d) killed" % pid
37   -
38   - # Reconfigure interface
39   - #print "Reconfiguring peer %s Interface" % peer_ip_wired
40   - utils_config.exec_command_ssh(peer_ip_wired, "rmmod b43 && sleep 1")
41   - utils_config.exec_command_ssh(peer_ip_wired, "rmmod mac80211")
42   - utils_config.exec_command_ssh(peer_ip_wired, "rm /lib/firmware/b43")
43   - utils_config.exec_command_ssh(peer_ip_wired, "rm %s/b43/b43.ko" % path_module_b43)
44   - utils_config.exec_command_ssh(peer_ip_wired, "rm %s/b43" % path_module_b43)
45   - utils_config.exec_command_ssh(peer_ip_wired, "rm %s/mac80211.ko" % path_module_80211)
46   - utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/mac80211.video.ko %s/mac80211.ko" % (path_module_80211, path_module_80211))
47   - utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43.video %s/b43" % (path_module_b43,path_module_b43))
48   - time.sleep(0.5)
49   - utils_config.exec_command_ssh(peer_ip_wired, "modprobe mac80211")
50   -
51   -
52   -# Enable b43 module using different sources depending of the selected mechanism
53   -# - Input: Peer address, mechanism
54   -def set_mechanism(peer_ip_wired, mechanism):
55   - #print "Mechanism %s selected for the peer" % mechanism
56   -
57   - if mechanism == "BLOCK_ACK":
58   - set_block_ack()
59   - elif mechanism == "DMS":
60   - set_dms()
61   - elif mechanism == "UR":
62   - set_ur()
63   - elif mechanism == "LEGACY":
64   - utils_config.exec_command_ssh(peer_ip_wired, "ln -s /lib/firmware/b43.legacy/ /lib/firmware/b43")
65   - #utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43/b43-2.6.36-orig.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
66   - utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43/b43.orig-dmasingleworker.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
67   - utils_config.exec_command_ssh(peer_ip_wired, "modprobe b43 qos=1 && sleep 1")
68   -
69   -
70   -# Start peer with the given configuration, set up wlan0 (peer_ip -> 192.168.98.xxx) and join to the AP
71   -# - Input: Input: Peer address, rate, channel and power that we want to stablish in the AP
72   -def start_ap(peer_ip_wired, peer_ip, bssid, rate, power, channel):
73   - # Up wlan0 ,search and join AP
74   - utils_config.exec_command_ssh(peer_ip_wired, "ifconfig wlan0 %s up" % peer_ip)
75   - utils_config.exec_command_ssh(peer_ip_wired, "iwlist wlan0 scan | grep %s -C 5" % bssid)
76   - utils_config.exec_command_ssh(peer_ip_wired, "wpa_supplicant -B -Dwext -iwlan0 -c/root/wpa_supplicant.conf")
77   - utils_config.exec_command_ssh(peer_ip_wired, "iwconfig wlan0 rate %s fixed channel %s txpower %s fixed" % (rate, channel, power))
78   -
79   - #print "Configuring multicast route"
80   - #utils_config.exec_command_ssh(peer_ip_wired, "route add -host 224.0.0.1 wlan0")
81   -
82   - #print "Setting arp table"
83   - #utils_config.exec_command_ssh(peer_ip_wired, "/root/setarp.sh 192.168.98.10")
84   -
85   -# Check if all the configuration is correctly set
86   -# - Input: Peer address (wired and wlan0 interface)
87   -def check_peer(peer_ip_wired, peer_ip):
88   - if utils_config.exec_command_ssh(peer_ip_wired, "modprobe -l | grep mac80211.ko") == "ERROR":
89   - return "mac80211"
90   - elif utils_config.exec_command_ssh(peer_ip_wired, "modprobe -l | grep b43.ko") == "ERROR":
91   - return "b43"
92   - else:
93   - time.sleep(0.5)
94   - peer_status = utils_config.check_ping(peer_ip)
95   - if peer_status != "ok":
96   - return "ERROR"
97   - else:
98   - return "ok"
99   -
100   -def set_block_ack(peer_ip_wired, rate, b_size):
101   - utils_config.exec_command("cp %s/%s/ucode5.back-%s.fw %s/ucode5.fw" % (path_firm_b43_blockack, rate, b_size, path_firm_b43_blockack))
102   - utils_config.exec_command_ssh(peer_ip_wired, "cp %s/%s/ucode5.back-%s.fw %s/ucode5.fw" % (path_firm_b43_blockack, rate, b_size, path_firm_b43_blockack))
103   -
104   - utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/ /lib/firmware/b43" % path_firm_b43_blockack)
105   - utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43/b43.rate-adaptation.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
106   - utils_config.exec_command_ssh(peer_ip_wired, "modprobe b43 qos=1 aseq=1 frate=1 bsize=%s brate=%s && sleep 0.5" % (b_size, rate))
107   -
108   -