tests: Decode Popen() output for python3
Need to do this to avoid issues with following operations that assume the output to be a str object. Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
parent
15dfcb69df
commit
1c48c9bcf9
2 changed files with 10 additions and 10 deletions
|
@ -90,7 +90,7 @@ class HapdRegCtrl:
|
||||||
|
|
||||||
def fst_clear_regdom():
|
def fst_clear_regdom():
|
||||||
cmd = subprocess.Popen([ "iw", "reg", "get" ], stdout=subprocess.PIPE)
|
cmd = subprocess.Popen([ "iw", "reg", "get" ], stdout=subprocess.PIPE)
|
||||||
res = cmd.stdout.read()
|
res = cmd.stdout.read().decode()
|
||||||
cmd.stdout.close()
|
cmd.stdout.close()
|
||||||
if "country 00:" not in res:
|
if "country 00:" not in res:
|
||||||
subprocess.call(['iw', 'reg', 'set', '00'])
|
subprocess.call(['iw', 'reg', 'set', '00'])
|
||||||
|
|
|
@ -139,14 +139,14 @@ def log_ip_macsec():
|
||||||
cmd = subprocess.Popen([ "ip", "macsec", "show" ],
|
cmd = subprocess.Popen([ "ip", "macsec", "show" ],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=open('/dev/null', 'w'))
|
stderr=open('/dev/null', 'w'))
|
||||||
res = cmd.stdout.read()
|
res = cmd.stdout.read().decode()
|
||||||
cmd.stdout.close()
|
cmd.stdout.close()
|
||||||
logger.info("ip macsec:\n" + res)
|
logger.info("ip macsec:\n" + res)
|
||||||
|
|
||||||
def log_ip_link():
|
def log_ip_link():
|
||||||
cmd = subprocess.Popen([ "ip", "link", "show" ],
|
cmd = subprocess.Popen([ "ip", "link", "show" ],
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
res = cmd.stdout.read()
|
res = cmd.stdout.read().decode()
|
||||||
cmd.stdout.close()
|
cmd.stdout.close()
|
||||||
logger.info("ip link:\n" + res)
|
logger.info("ip link:\n" + res)
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ def log_ip_macsec_ns():
|
||||||
cmd = subprocess.Popen([ "ip", "macsec", "show" ],
|
cmd = subprocess.Popen([ "ip", "macsec", "show" ],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=open('/dev/null', 'w'))
|
stderr=open('/dev/null', 'w'))
|
||||||
res = cmd.stdout.read()
|
res = cmd.stdout.read().decode()
|
||||||
cmd.stdout.close()
|
cmd.stdout.close()
|
||||||
logger.info("ip macsec show:\n" + res)
|
logger.info("ip macsec show:\n" + res)
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ def log_ip_macsec_ns():
|
||||||
"ip", "macsec", "show" ],
|
"ip", "macsec", "show" ],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=open('/dev/null', 'w'))
|
stderr=open('/dev/null', 'w'))
|
||||||
res = cmd.stdout.read()
|
res = cmd.stdout.read().decode()
|
||||||
cmd.stdout.close()
|
cmd.stdout.close()
|
||||||
logger.info("ip macsec show (ns0):\n" + res)
|
logger.info("ip macsec show (ns0):\n" + res)
|
||||||
|
|
||||||
|
@ -475,14 +475,14 @@ def log_ip_macsec_ns():
|
||||||
"ip", "macsec", "show" ],
|
"ip", "macsec", "show" ],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=open('/dev/null', 'w'))
|
stderr=open('/dev/null', 'w'))
|
||||||
res = cmd.stdout.read()
|
res = cmd.stdout.read().decode()
|
||||||
cmd.stdout.close()
|
cmd.stdout.close()
|
||||||
logger.info("ip macsec show (ns1):\n" + res)
|
logger.info("ip macsec show (ns1):\n" + res)
|
||||||
|
|
||||||
def log_ip_link_ns():
|
def log_ip_link_ns():
|
||||||
cmd = subprocess.Popen([ "ip", "link", "show" ],
|
cmd = subprocess.Popen([ "ip", "link", "show" ],
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
res = cmd.stdout.read()
|
res = cmd.stdout.read().decode()
|
||||||
cmd.stdout.close()
|
cmd.stdout.close()
|
||||||
logger.info("ip link:\n" + res)
|
logger.info("ip link:\n" + res)
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ def log_ip_link_ns():
|
||||||
"ip", "link", "show" ],
|
"ip", "link", "show" ],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=open('/dev/null', 'w'))
|
stderr=open('/dev/null', 'w'))
|
||||||
res = cmd.stdout.read()
|
res = cmd.stdout.read().decode()
|
||||||
cmd.stdout.close()
|
cmd.stdout.close()
|
||||||
logger.info("ip link show (ns0):\n" + res)
|
logger.info("ip link show (ns0):\n" + res)
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ def log_ip_link_ns():
|
||||||
"ip", "link", "show" ],
|
"ip", "link", "show" ],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=open('/dev/null', 'w'))
|
stderr=open('/dev/null', 'w'))
|
||||||
res = cmd.stdout.read()
|
res = cmd.stdout.read().decode()
|
||||||
cmd.stdout.close()
|
cmd.stdout.close()
|
||||||
logger.info("ip link show (ns1):\n" + res)
|
logger.info("ip link show (ns1):\n" + res)
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ def run_macsec_psk_ns(dev, apdev, params):
|
||||||
c = subprocess.Popen(['ip', 'netns', 'exec', 'ns0',
|
c = subprocess.Popen(['ip', 'netns', 'exec', 'ns0',
|
||||||
'ping', '-c', '2', '192.168.248.18'],
|
'ping', '-c', '2', '192.168.248.18'],
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
res = c.stdout.read()
|
res = c.stdout.read().decode()
|
||||||
c.stdout.close()
|
c.stdout.close()
|
||||||
logger.info("ping:\n" + res)
|
logger.info("ping:\n" + res)
|
||||||
if "2 packets transmitted, 2 received" not in res:
|
if "2 packets transmitted, 2 received" not in res:
|
||||||
|
|
Loading…
Reference in a new issue