Add the feature to execute shell commands on each wpa_supplicant/hostapd
interface host. When executing remote tests the interfaces are not all
on a single host so when executing shell commands the test needs to
execute the command on the host which the interface relevant for the
command is on. This patch enables tests to execute the command on the
relevant host.
Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
import wpaspy
import remotehost
import utils
import wpaspy
import remotehost
import utils
logger = logging.getLogger()
hapd_ctrl = '/var/run/hostapd'
logger = logging.getLogger()
hapd_ctrl = '/var/run/hostapd'
self.dbg = hostname + "/" + str(port)
self.mon.attach()
self.dbg = hostname + "/" + str(port)
self.mon.attach()
+ def cmd_execute(self, cmd_array):
+ if self.hostname is None:
+ cmd = ' '.join(cmd_array)
+ proc = subprocess.Popen(cmd, stderr=subprocess.STDOUT,
+ stdout=subprocess.PIPE, shell=True)
+ out = proc.communicate()[0]
+ ret = proc.returncode
+ return ret, out
+ else:
+ return self.host.execute(cmd_array)
+
def request(self, cmd, timeout=10):
logger.debug(self.dbg + ": CTRL(global): " + cmd)
return self.ctrl.request(cmd, timeout)
def request(self, cmd, timeout=10):
logger.debug(self.dbg + ": CTRL(global): " + cmd)
return self.ctrl.request(cmd, timeout)
self.bssid = None
self.bssidx = bssidx
self.bssid = None
self.bssidx = bssidx
+ def cmd_execute(self, cmd_array):
+ if self.hostname is None:
+ cmd = ""
+ for arg in cmd_array:
+ cmd += arg + " "
+ cmd = cmd.strip()
+ proc = subprocess.Popen(cmd, stderr=subprocess.STDOUT,
+ stdout=subprocess.PIPE, shell=True)
+ out = proc.communicate()[0]
+ ret = proc.returncode
+ return ret, out
+ else:
+ return self.host.execute(cmd_array)
+
def close_ctrl(self):
if self.mon is not None:
self.mon.detach()
def close_ctrl(self):
if self.mon is not None:
self.mon.detach()
params = ht20_params(channel, ssid, country)
params['ht_capab'] = "[HT40-]"
return params
params = ht20_params(channel, ssid, country)
params['ht_capab'] = "[HT40-]"
return params
+
+def cmd_execute(apdev, cmd):
+ hapd_global = HostapdGlobal(apdev)
+ return hapd_global.cmd_execute(cmd)
import struct
import wpaspy
import remotehost
import struct
import wpaspy
import remotehost
logger = logging.getLogger()
wpas_ctrl = '/var/run/wpa_supplicant'
logger = logging.getLogger()
wpas_ctrl = '/var/run/wpa_supplicant'
else:
self.global_mon = None
else:
self.global_mon = None
+ def cmd_execute(self, cmd_array):
+ if self.hostname is None:
+ cmd = ' '.join(cmd_array)
+ proc = subprocess.Popen(cmd, stderr=subprocess.STDOUT,
+ stdout=subprocess.PIPE, shell=True)
+ out = proc.communicate()[0]
+ ret = proc.returncode
+ return ret, out
+ else:
+ return self.host.execute(cmd_array)
+
def terminate(self):
if self.global_mon:
self.global_mon.detach()
def terminate(self):
if self.global_mon:
self.global_mon.detach()