tests: Use cmd_execute() for ip addr add/del

The hwsim tests used to execute shell commands in the tests using the
subprocess python module. Use the cmd_execute() general function for
executing "ip addr add/del .." so that this would also work on remote
setups.

Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
This commit is contained in:
Jonathan Afek 2016-06-23 20:16:29 +03:00 committed by Jouni Malinen
parent 2d588c6578
commit 40c62e6e8d

View file

@ -1259,14 +1259,14 @@ def test_wpas_ctrl_roam(dev, apdev):
def test_wpas_ctrl_ipaddr(dev, apdev):
"""wpa_supplicant IP address in STATUS"""
try:
subprocess.call(['ip', 'addr', 'add', '10.174.65.207/32', 'dev',
dev[0].ifname])
dev[0].cmd_execute(['ip', 'addr', 'add', '10.174.65.207/32', 'dev',
dev[0].ifname])
ipaddr = dev[0].get_status_field('ip_address')
if ipaddr != '10.174.65.207':
raise Exception("IP address not in STATUS output")
finally:
subprocess.call(['ip', 'addr', 'del', '10.174.65.207/32', 'dev',
dev[0].ifname])
dev[0].cmd_execute(['ip', 'addr', 'del', '10.174.65.207/32', 'dev',
dev[0].ifname])
def test_wpas_ctrl_rsp(dev, apdev):
"""wpa_supplicant ctrl_iface CTRL-RSP-"""