def __enter__(self):
if self._tracing:
output = os.path.abspath(os.path.join(self._logdir, '%s.dat' % (self._testname, )))
- self._trace_cmd = subprocess.Popen(['sudo', 'trace-cmd', 'record', '-o', output, '-e', 'mac80211', '-e', 'cfg80211', '-e', 'printk', 'sh', '-c', 'echo STARTED ; read l'],
+ self._trace_cmd = subprocess.Popen(['trace-cmd', 'record', '-o', output, '-e', 'mac80211', '-e', 'cfg80211', '-e', 'printk', 'sh', '-c', 'echo STARTED ; read l'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=open('/dev/null', 'w'),
self._trace_cmd.wait()
if self._dmesg:
output = os.path.join(self._logdir, '%s.dmesg' % (self._testname, ))
- subprocess.call(['sudo', 'dmesg', '-c'], stdout=open(output, 'w'))
+ subprocess.call(['dmesg', '-c'], stdout=open(output, 'w'))
def rename_log(logdir, basename, testname, dev):
try:
os.rename(srcname, dstname)
if dev:
dev.relog()
- subprocess.call(['sudo', 'chown', '-f', getpass.getuser(), srcname])
+ subprocess.call(['chown', '-f', getpass.getuser(), srcname])
except Exception, e:
logger.info("Failed to rename log files")
logger.info(e)
sys.exit(1)
if args.dmesg:
- subprocess.call(['sudo', 'dmesg', '-c'], stdout=open('/dev/null', 'w'))
+ subprocess.call(['dmesg', '-c'], stdout=open('/dev/null', 'w'))
if conn and args.prefill:
for t in tests_to_run:
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_acs_5ghz_40mhz(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_acs_vht(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_acs_bias(dev, apdev):
from test_ap_csa import csa_supported
def clear_scan_cache(ifname):
- subprocess.call(['sudo', 'ifconfig', ifname, 'up'])
- subprocess.call(['sudo', 'iw', ifname, 'scan', 'freq', '2412', 'flush'])
+ subprocess.call(['ifconfig', ifname, 'up'])
+ subprocess.call(['iw', ifname, 'scan', 'freq', '2412', 'flush'])
time.sleep(0.1)
- subprocess.call(['sudo', 'ifconfig', ifname, 'down'])
+ subprocess.call(['ifconfig', ifname, 'down'])
def test_ap_ht40_scan(dev, apdev):
"""HT40 co-ex scan"""
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_ht40_5ghz_switch(dev, apdev):
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
def test_ap_ht40_5ghz_switch2(dev, apdev):
"""HT40 co-ex scan on 5 GHz switching pri/sec channel (2)"""
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_obss_scan(dev, apdev):
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
def test_ap_require_ht(dev, apdev):
"""Require HT"""
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_ht40_csa2(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_ht40_csa3(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_ht_smps(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_acl_accept(dev, apdev):
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
try:
- subprocess.call(['sudo', 'brctl', 'addbr', 'wds-br0'])
- subprocess.call(['sudo', 'brctl', 'setfd', 'wds-br0', '0'])
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'wds-br0', 'up'])
- subprocess.call(['sudo', 'iw', dev[0].ifname, 'set', '4addr', 'on'])
+ subprocess.call(['brctl', 'addbr', 'wds-br0'])
+ subprocess.call(['brctl', 'setfd', 'wds-br0', '0'])
+ subprocess.call(['ip', 'link', 'set', 'dev', 'wds-br0', 'up'])
+ subprocess.call(['iw', dev[0].ifname, 'set', '4addr', 'on'])
dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
hwsim_utils.test_connectivity_iface(dev[0], hapd, "wds-br0",
max_tries=15)
finally:
- subprocess.call(['sudo', 'iw', dev[0].ifname, 'set', '4addr', 'off'])
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'wds-br0', 'down'])
- subprocess.call(['sudo', 'brctl', 'delbr', 'wds-br0'])
+ subprocess.call(['iw', dev[0].ifname, 'set', '4addr', 'off'])
+ subprocess.call(['ip', 'link', 'set', 'dev', 'wds-br0', 'down'])
+ subprocess.call(['brctl', 'delbr', 'wds-br0'])
def test_ap_inactivity_poll(dev, apdev):
"""AP using inactivity poll"""
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_max_listen_interval(dev, apdev):
params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
params['bridge'] = 'ap-br0'
hostapd.add_ap(apdev[0]['ifname'], params)
- subprocess.call(['sudo', 'brctl', 'setfd', 'ap-br0', '0'])
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'up'])
+ subprocess.call(['brctl', 'setfd', 'ap-br0', '0'])
+ subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'up'])
dev[0].connect(ssid, psk=passphrase, scan_freq="2412",
bssid=apdev[0]['bssid'])
dev[1].connect(ssid, psk=passphrase, scan_freq="2412",
if addr0 in macs2 or addr1 in macs2:
raise Exception("Bridge FDB entry was not removed")
finally:
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'down'])
- subprocess.call(['sudo', 'brctl', 'delbr', 'ap-br0'])
+ subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'down'])
+ subprocess.call(['brctl', 'delbr', 'ap-br0'])
def test_ap_wpa2_already_in_bridge(dev, apdev):
"""hostapd behavior with interface already in bridge"""
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
hostapd.add_ap(apdev[1]['ifname'], params)
wlantest_setup()
- subprocess.call(['sudo', 'brctl', 'setfd', 'ap-br0', '0'])
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'up'])
+ subprocess.call(['brctl', 'setfd', 'ap-br0', '0'])
+ subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'up'])
dev[0].connect(ssid, psk=passphrase, scan_freq="2412",
bssid=apdev[0]['bssid'])
dev[1].connect(ssid, psk=passphrase, scan_freq="2412",
time.sleep(1)
hwsim_utils.test_connectivity_sta(dev[0], dev[1])
finally:
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'down'])
- subprocess.call(['sudo', 'brctl', 'delbr', 'ap-br0'])
+ subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'down'])
+ subprocess.call(['brctl', 'delbr', 'ap-br0'])
def test_ap_wpa2_tdls_responder_teardown(dev, apdev):
"""TDLS teardown from responder with WPA2-PSK AP"""
dev[1].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
dev[1].flush_scan_cache()
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_vht80_params(dev, apdev):
dev[1].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
dev[1].flush_scan_cache()
dev.request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev.flush_scan_cache()
def test_ap_vht_40(devs, apdevs):
dev.request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev.flush_scan_cache()
def test_ap_vht_capab_not_supported(dev, apdev):
if "OK" not in hapd.request("SET vht_capab [MAX-A-MPDU-LEN-EXP%d]" % i):
raise Exception("Unexpected SET failure")
finally:
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
def test_ap_vht160(dev, apdev):
"""VHT with 160 MHz channel width"""
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
dev[1].flush_scan_cache()
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
dev[1].flush_scan_cache()
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_vht_on_24ghz(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_wps_conf_chan14(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_ap_wps_twice(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_dfs_radar(dev, apdev):
hapd.request("DISABLE")
if hapd2:
hapd2.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_dfs_radar_on_non_dfs_channel(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_dfs_radar_chanlist_vht80(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_dfs_radar_chanlist_vht20(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_dfs_radar_no_ht(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_nfc_wps_handover_chan14(dev, apdev):
dev[0].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
def test_nfc_wps_handover_with_pw_token_set(dev, apdev):
wpas.interface_add("wlan5")
res = autogo(wpas)
wpas.dump_monitor()
- subprocess.call(['sudo', 'ifconfig', res['ifname'], 'down'])
+ subprocess.call(['ifconfig', res['ifname'], 'down'])
ev = wpas.wait_global_event(["P2P-GROUP-REMOVED"], timeout=10)
if ev is None:
raise Exception("Group removal not reported")
if "OK" not in dev[0].request("AUTOSCAN periodic:1"):
raise Exception("Failed to set autoscan")
autogo(dev[0])
- subprocess.call(['sudo', 'brctl', 'addbr', 'p2p-br0'])
- subprocess.call(['sudo', 'brctl', 'setfd', 'p2p-br0', '0'])
- subprocess.call(['sudo', 'brctl', 'addif', 'p2p-br0', dev[0].ifname])
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'p2p-br0', 'up'])
+ subprocess.call(['brctl', 'addbr', 'p2p-br0'])
+ subprocess.call(['brctl', 'setfd', 'p2p-br0', '0'])
+ subprocess.call(['brctl', 'addif', 'p2p-br0', dev[0].ifname])
+ subprocess.call(['ip', 'link', 'set', 'dev', 'p2p-br0', 'up'])
time.sleep(0.1)
- subprocess.call(['sudo', 'brctl', 'delif', 'p2p-br0', dev[0].ifname])
+ subprocess.call(['brctl', 'delif', 'p2p-br0', dev[0].ifname])
time.sleep(0.1)
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'p2p-br0', 'down'])
+ subprocess.call(['ip', 'link', 'set', 'dev', 'p2p-br0', 'down'])
time.sleep(0.1)
- subprocess.call(['sudo', 'brctl', 'delbr', 'p2p-br0'])
+ subprocess.call(['brctl', 'delbr', 'p2p-br0'])
ev = dev[0].wait_global_event(["P2P-GROUP-REMOVED"], timeout=1)
if ev is not None:
raise Exception("P2P group removed unexpectedly")
dev[0].remove_group()
finally:
dev[0].request("AUTOSCAN ")
- subprocess.Popen(['sudo', 'brctl', 'delif', 'p2p-br0', dev[0].ifname],
+ subprocess.Popen(['brctl', 'delif', 'p2p-br0', dev[0].ifname],
stderr=open('/dev/null', 'w'))
- subprocess.Popen(['sudo', 'ip', 'link', 'set', 'dev', 'p2p-br0', 'down'],
+ subprocess.Popen(['ip', 'link', 'set', 'dev', 'p2p-br0', 'down'],
stderr=open('/dev/null', 'w'))
- subprocess.Popen(['sudo', 'brctl', 'delbr', 'p2p-br0'],
+ subprocess.Popen(['brctl', 'delbr', 'p2p-br0'],
stderr=open('/dev/null', 'w'))
def test_presence_req_on_group_interface(dev):
from test_p2p_autogo import autogo
def set_country(country, dev=None):
- subprocess.call(['sudo', 'iw', 'reg', 'set', country])
+ subprocess.call(['iw', 'reg', 'set', country])
time.sleep(0.1)
if dev:
for i in range(10):
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
params['bridge'] = 'ap-br0'
hostapd.add_ap(apdev[0]['ifname'], params)
- subprocess.call(['sudo', 'brctl', 'setfd', 'ap-br0', '0'])
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'up'])
+ subprocess.call(['brctl', 'setfd', 'ap-br0', '0'])
+ subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'up'])
eap_connect(dev[0], apdev[0], "PAX", "pax.user@example.com",
password_hex="0123456789abcdef0123456789abcdef")
raise Exception("Unexpected PMKID change")
finally:
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'down'])
- subprocess.call(['sudo', 'brctl', 'delbr', 'ap-br0'])
+ subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'down'])
+ subprocess.call(['brctl', 'delbr', 'ap-br0'])
def test_pmksa_cache_disabled(dev, apdev):
"""PMKSA cache disabling on AP"""
def test_radius_auth_unreachable2(dev, apdev):
"""RADIUS Authentication server unreachable (2)"""
- subprocess.call(['sudo', 'ip', 'ro', 'replace', '192.168.213.17', 'dev',
- 'lo'])
+ subprocess.call(['ip', 'ro', 'replace', '192.168.213.17', 'dev', 'lo'])
params = hostapd.wpa2_eap_params(ssid="radius-auth")
params['auth_server_addr'] = "192.168.213.17"
params['auth_server_port'] = "18139"
hostapd.add_ap(apdev[0]['ifname'], params)
hapd = hostapd.Hostapd(apdev[0]['ifname'])
- subprocess.call(['sudo', 'ip', 'ro', 'del', '192.168.213.17', 'dev', 'lo'])
+ subprocess.call(['ip', 'ro', 'del', '192.168.213.17', 'dev', 'lo'])
connect(dev[0], "radius-auth", wait_connect=False)
ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED"])
if ev is None:
def test_radius_acct_unreachable2(dev, apdev):
"""RADIUS Accounting server unreachable(2)"""
- subprocess.call(['sudo', 'ip', 'ro', 'replace', '192.168.213.17', 'dev',
- 'lo'])
+ subprocess.call(['ip', 'ro', 'replace', '192.168.213.17', 'dev', 'lo'])
params = hostapd.wpa2_eap_params(ssid="radius-acct")
params['acct_server_addr'] = "192.168.213.17"
params['acct_server_port'] = "18139"
params['acct_server_shared_secret'] = "radius"
hostapd.add_ap(apdev[0]['ifname'], params)
hapd = hostapd.Hostapd(apdev[0]['ifname'])
- subprocess.call(['sudo', 'ip', 'ro', 'del', '192.168.213.17', 'dev', 'lo'])
+ subprocess.call(['ip', 'ro', 'del', '192.168.213.17', 'dev', 'lo'])
connect(dev[0], "radius-acct")
logger.info("Checking for RADIUS retries")
time.sleep(4)
def test_radius_failover(dev, apdev):
"""RADIUS Authentication and Accounting server failover"""
- subprocess.call(['sudo', 'ip', 'ro', 'replace', '192.168.213.17', 'dev',
- 'lo'])
+ subprocess.call(['ip', 'ro', 'replace', '192.168.213.17', 'dev', 'lo'])
as_hapd = hostapd.Hostapd("as")
as_mib_start = as_hapd.get_mib(param="radius_server")
params = hostapd.wpa2_eap_params(ssid="radius-failover")
raise Exception("AP startup failed")
try:
- subprocess.call(['sudo', 'ip', 'ro', 'replace', 'prohibit',
- '192.168.213.17'])
+ subprocess.call(['ip', 'ro', 'replace', 'prohibit', '192.168.213.17'])
dev[0].request("SET EAPOL::authPeriod 5")
connect(dev[0], "radius-failover", wait_connect=False)
dev[0].wait_connected(timeout=60)
finally:
dev[0].request("SET EAPOL::authPeriod 30")
- subprocess.call(['sudo', 'ip', 'ro', 'del', '192.168.213.17'])
+ subprocess.call(['ip', 'ro', 'del', '192.168.213.17'])
as_mib_end = as_hapd.get_mib(param="radius_server")
req_s = int(as_mib_start['radiusAccServTotalRequests'])
"""Avoid operations during externally triggered scan"""
hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-scan" })
bssid = apdev[0]['bssid']
- subprocess.call(['sudo', 'iw', dev[0].ifname, 'scan', 'trigger'])
+ subprocess.call(['iw', dev[0].ifname, 'scan', 'trigger'])
check_scan(dev[0], "use_id=1", other_started=True)
def test_scan_bss_expiration_count(dev, apdev):
wpas.request("ENABLE_NETWORK " + str(id) + " no-connect")
wpas.request("SCAN")
time.sleep(0.5)
- subprocess.call(['sudo', 'iw', wpas.ifname, 'connect', 'test', '2412'])
+ subprocess.call(['iw', wpas.ifname, 'connect', 'test', '2412'])
wpas.wait_connected(timeout=10)
wpas.request("SCAN")
wpas.wait_connected(timeout=5)
id = wpas.connect("", key_mgmt="NONE", bssid=bssid,
only_add_network=True)
wpas.request("ENABLE_NETWORK " + str(id) + " no-connect")
- subprocess.call(['sudo', 'iw', wpas.ifname, 'scan', 'trigger',
- 'freq', '2412'])
+ subprocess.call(['iw', wpas.ifname, 'scan', 'trigger', 'freq', '2412'])
time.sleep(1)
- subprocess.call(['sudo', 'iw', wpas.ifname, 'connect', 'test', '2412'])
+ subprocess.call(['iw', wpas.ifname, 'connect', 'test', '2412'])
wpas.wait_connected(timeout=10)
wpas.request("SET disallow_aps bssid " + bssid)
wpas.wait_disconnected(timeout=10)
- subprocess.call(['sudo', 'iw', wpas.ifname, 'connect', 'test', '2412'])
+ subprocess.call(['iw', wpas.ifname, 'connect', 'test', '2412'])
ev = wpas.wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
if ev is not None:
raise Exception("Unexpected connection reported")
wpas.interface_add("wlan5")
wpas.connect("sta-dynamic", psk="12345678", scan_freq="2412")
hwsim_utils.test_connectivity(wpas, hapd)
- subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'down'])
+ subprocess.call(['ifconfig', wpas.ifname, 'down'])
wpas.wait_disconnected(timeout=10)
if wpas.get_status_field("wpa_state") != "INTERFACE_DISABLED":
raise Exception("Unexpected wpa_state")
- subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'up'])
+ subprocess.call(['ifconfig', wpas.ifname, 'up'])
wpas.wait_connected(timeout=15, error="Reconnection not reported")
hwsim_utils.test_connectivity(wpas, hapd)
wpas.interface_add("wlan5")
wpas.connect("sta-dynamic", psk="12345678", scan_freq="2412")
hwsim_utils.test_connectivity(wpas, hapd)
- subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'down'])
+ subprocess.call(['ifconfig', wpas.ifname, 'down'])
wpas.wait_disconnected(timeout=10)
if wpas.get_status_field("wpa_state") != "INTERFACE_DISABLED":
raise Exception("Unexpected wpa_state")
prev_addr = wpas.p2p_interface_addr()
new_addr = '02:11:22:33:44:55'
try:
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', wpas.ifname,
+ subprocess.call(['ip', 'link', 'set', 'dev', wpas.ifname,
'address', new_addr])
- subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'up'])
+ subprocess.call(['ifconfig', wpas.ifname, 'up'])
wpas.wait_connected(timeout=15, error="Reconnection not reported")
if wpas.get_driver_status_field('addr') != new_addr:
raise Exception("Address change not reported")
if sta['addr'] != new_addr:
raise Exception("STA association with new address not found")
finally:
- subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'down'])
- subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', wpas.ifname,
+ subprocess.call(['ifconfig', wpas.ifname, 'down'])
+ subprocess.call(['ip', 'link', 'set', 'dev', wpas.ifname,
'address', prev_addr])
- subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'up'])
+ subprocess.call(['ifconfig', wpas.ifname, 'up'])
def test_sta_dynamic_random_mac_addr(dev, apdev):
"""Dynamically added wpa_supplicant interface and random MAC address"""
if "init=CORE type=WORLD" not in ev:
raise Exception("Unexpected event contents: " + ev)
finally:
- subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ subprocess.call(['iw', 'reg', 'set', '00'])
def test_wpas_ctrl_suspend_resume(dev):
"""wpa_supplicant SUSPEND/RESUME"""
logger.error(self.ifname + ": Driver scan state did not clear")
print "Trying to clear cfg80211/mac80211 scan state"
try:
- cmd = ["sudo", "ifconfig", self.ifname, "down"]
+ cmd = ["ifconfig", self.ifname, "down"]
subprocess.call(cmd)
except subprocess.CalledProcessError, e:
logger.info("ifconfig failed: " + str(e.returncode))
logger.info(e.output)
try:
- cmd = ["sudo", "ifconfig", self.ifname, "up"]
+ cmd = ["ifconfig", self.ifname, "up"]
subprocess.call(cmd)
except subprocess.CalledProcessError, e:
logger.info("ifconfig failed: " + str(e.returncode))