def set_rts_nodes(disable_rts=False, ifc="mesh0"): rts_th = "10" if not disable_rts else "off" command = "iwconfig {} rts {}".format(ifc, rts_th) for node in nodes: host = "{}:{}".format(node.forward_ip, node.port) s = cmd.connect(host) cmd.exec_cmd(s, command)
def set_rate_nodes(rate="2", ifc="mesh0"): if not rate == "auto": rate = rate + "M fixed" command = "iwconfig {} rate {}".format(ifc, rate) for node in nodes: host = "{}:{}".format(node.forward_ip, node.port) s = cmd.connect(host) cmd.exec_cmd(s, command)
def read_ath(self): sock = cmd.connect(self.host) ath = cmd.exec_cmd(sock, cmd.ath_cmd) sock.close() out = {} out['tx_management'] = int( re.findall("(\d+) tx management frames", ath)[0]) out['tx_failed'] = int( re.findall("(\d+) tx failed due to too many retries", ath)[0]) out['tx_short_retries'] = int( re.findall("(\d+) short on-chip tx retries", ath)[0]) out['tx_long_retries'] = int( re.findall("(\d+) long on-chip tx retries", ath)[0]) out['tx_noack'] = int( re.findall("(\d+) tx frames with no ack marked", ath)[0]) out['tx_rts'] = int( re.findall("(\d+) tx frames with rts enabled", ath)[0]) out['tx_short'] = int( re.findall("(\d+) tx frames with short preamble", ath)[0]) out['rx_bad_crc'] = int( re.findall("(\d+) rx failed due to bad CRC", ath)[0]) out['rx_too_short'] = int( re.findall("(\d+) rx failed due to frame too short", ath)[0]) out['rx_phy_err'] = int(re.findall("(\d+) PHY errors", ath)[0]) out['rx'] = sum(map(lambda x: int(x), re.findall(" rx +(\d+)", ath))) out['tx'] = sum(map(lambda x: int(x), re.findall(" tx +(\d+)", ath))) return out
def read_ath(self): sock = cmd.connect(self.host) ath = cmd.exec_cmd(sock, cmd.ath_cmd) sock.close() out = {} out['tx_management'] = int(re.findall("(\d+) tx management frames", ath)[0]) out['tx_failed'] = int(re.findall("(\d+) tx failed due to too many retries", ath)[0]) out['tx_short_retries'] = int(re.findall("(\d+) short on-chip tx retries", ath)[0]) out['tx_long_retries'] = int(re.findall("(\d+) long on-chip tx retries", ath)[0]) out['tx_noack'] = int(re.findall("(\d+) tx frames with no ack marked", ath)[0]) out['tx_rts'] = int(re.findall("(\d+) tx frames with rts enabled", ath)[0]) out['tx_short'] = int(re.findall("(\d+) tx frames with short preamble", ath)[0]) out['rx_bad_crc'] = int(re.findall("(\d+) rx failed due to bad CRC", ath)[0]) out['rx_too_short'] = int(re.findall("(\d+) rx failed due to frame too short", ath)[0]) out['rx_phy_err'] = int(re.findall("(\d+) PHY errors", ath)[0]) out['rx'] = sum(map(lambda x: int(x), re.findall(" rx +(\d+)", ath))) out['tx'] = sum(map(lambda x: int(x), re.findall(" tx +(\d+)", ath))) return out
def set_tx_nodes(tx): for node in nodes: host = "{}:{}".format(node.forward_ip, node.port) s = cmd.connect(host) cmd.exec_cmd(s, "iwconfig mesh0 txpower {}".format(tx))