Commit 7cf3fe8c10600ec76b58d8711cf6ecc50d00e30f

Authored by Ginés García
1 parent b73188ee

Peers configuration implemented. Just need to be tested

Showing 1 changed file with 46 additions and 22 deletions   Show diff stats
utils_peers.py
... ... @@ -14,7 +14,7 @@ def configure_peer(peer_ip, peer_ip_wired, bssid, rate, power, channel, mechanis
14 14 print threading.currentThread().getName(), "configuring %s" % peer_ip_wired
15 15 reload_peer(peer_ip_wired)
16 16 set_mechanism(peer_ip_wired, mechanism)
17   - start_ap(peer_ip_wired, peer_ip, bssid, rate, power, channel)
  17 + start_peer(peer_ip_wired, peer_ip, bssid, rate, power, channel)
18 18  
19 19 peer_status = check_peer(peer_ip_wired, peer_ip)
20 20 if peer_status != "ok":
... ... @@ -57,31 +57,13 @@ def set_mechanism(peer_ip_wired, mechanism):
57 57 if mechanism == "BLOCK_ACK":
58 58 set_block_ack(peer_ip_wired, rate, b_size)
59 59 elif mechanism == "DMS":
60   - set_dms()
  60 + set_dms(peer_ip_wired, rate)
61 61 elif mechanism == "UR":
62   - set_ur()
  62 + set_ur(peer_ip_wired, rate, retries)
63 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")
  64 + set_legacy(peer_ip_wired, rate)
68 65  
69 66  
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 67 # Check if all the configuration is correctly set
86 68 # - Input: Peer address (wired and wlan0 interface)
87 69 def check_peer(peer_ip_wired, peer_ip):
... ... @@ -108,4 +90,46 @@ def set_block_ack(peer_ip_wired, rate, b_size):
108 90 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))
109 91 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))
110 92  
  93 +# Load modules in order to enable DMS mechanism
  94 +# - Input: Peer ip wired address and rate
  95 +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")
  99 +
  100 + 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 + utils_config.exec_command_ssh(peer_ip_wired, "modprobe b43 qos=0 brate=%s && sleep 1" % rate)
  102 +
  103 +# Load modules in order to enable UR mechanism
  104 +# - Input: Peer ip wired address, rate and retries
  105 +def set_ur(peer_ip_wired, rate, retries):
  106 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s /lib/firmware/b43.video/firmware.ur /lib/firmware/b43")
  107 + utils_config.exec_command_ssh(peer_ip_wired, "rm /lib/firmware/b43.video/firmware.ur/ucode5.fw")
  108 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s /lib/firmware/b43.video/firmware.ur/ucode5.ur-%s.fw /lib/firmware/b43/ucode5.fw" % retries)
  109 +
  110 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s %s/b43/b43.ur.ko %s/b43/b43.ko" % (path_module_b43, path_module_b43))
  111 + utils_config.exec_command_ssh(peer_ip_wired, "modprobe b43 qos=0 brate=%s && sleep 1" % rate)
111 112  
  113 +
  114 +# Load modules in order to enable LEGACY mechanism
  115 +# - Input: Peer ip wired address and rate
  116 +def set_legacy(peer_ip_wired, rate):
  117 + utils_config.exec_command_ssh(peer_ip_wired, "ln -s /lib/firmware/b43.video/firmware.dms /lib/firmware/b43")
  118 + 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))
  119 + utils_config.exec_command_ssh(peer_ip_wired, "modprobe b43 qos=0 brate=%s && sleep 1" % rate)
  120 +
  121 +
  122 +# Start peer with the given configuration, set up wlan0 (peer_ip -> 192.168.98.xxx) and join to the AP
  123 +# - Input: Input: Peer address, rate, channel and power that we want to stablish in the AP
  124 +def start_peer(peer_ip_wired, peer_ip, bssid, rate, power, channel):
  125 + # Up wlan0 ,search and join AP
  126 + utils_config.exec_command_ssh(peer_ip_wired, "ifconfig wlan0 %s up" % peer_ip)
  127 + utils_config.exec_command_ssh(peer_ip_wired, "iwlist wlan0 scan | grep %s -C 5" % bssid)
  128 + utils_config.exec_command_ssh(peer_ip_wired, "wpa_supplicant -B -Dwext -iwlan0 -c/root/wpa_supplicant.conf")
  129 + utils_config.exec_command_ssh(peer_ip_wired, "iwconfig wlan0 rate %s fixed channel %s txpower %s fixed" % (rate, channel, power))
  130 +
  131 + #print "Configuring multicast route"
  132 + utils_config.exec_command_ssh(peer_ip_wired, "route add -host 224.0.0.1 wlan0")
  133 +
  134 + #print "Setting arp table"
  135 + #utils_config.exec_command_ssh(peer_ip_wired, "/root/setarp.sh 192.168.98.10")
112 136 \ No newline at end of file
... ...