updated logging.warn to logging.warning due to deprecation in python3, fixed python 2/3 filter issue in tests, fixed utf decoding for some missed popen commands

This commit is contained in:
Blake Harnden 2019-06-03 14:36:21 -07:00
parent 69b1297002
commit 597bd21994
14 changed files with 70 additions and 66 deletions

View file

@ -169,7 +169,7 @@ class VnodeClient(object):
# wait for and return exit status
status = p.wait()
if status:
logging.warn("cmd exited with status %s: %s", status, args)
logging.warning("cmd exited with status %s: %s", status, args)
return status
def term(self, sh="/bin/sh"):
@ -247,16 +247,16 @@ class VnodeClient(object):
elif line[3] == "link":
interface["inet6link"].append(line[1])
else:
logging.warn("unknown scope: %s" % line[3])
logging.warning("unknown scope: %s" % line[3])
err = stderr.read()
stdout.close()
stderr.close()
status = p.wait()
if status:
logging.warn("nonzero exist status (%s) for cmd: %s", status, args)
logging.warning("nonzero exist status (%s) for cmd: %s", status, args)
if err:
logging.warn("error output: %s", err)
logging.warning("error output: %s", err)
self._addr[ifname] = interface
return interface
@ -275,11 +275,11 @@ class VnodeClient(object):
# ignore first line
stdout.readline()
# second line has count names
tmp = stdout.readline().strip().split("|")
tmp = stdout.readline().decode("utf-8").strip().split("|")
rxkeys = tmp[1].split()
txkeys = tmp[2].split()
for line in stdout:
line = line.strip().split()
line = line.decode("utf-8").strip().split()
devname, tmp = line[0].split(":")
if tmp:
line.insert(1, tmp)
@ -296,9 +296,9 @@ class VnodeClient(object):
stderr.close()
status = p.wait()
if status:
logging.warn("nonzero exist status (%s) for cmd: %s", status, args)
logging.warning("nonzero exist status (%s) for cmd: %s", status, args)
if err:
logging.warn("error output: %s", err)
logging.warning("error output: %s", err)
if ifname is not None:
return stats[ifname]
else:

View file

@ -481,7 +481,12 @@ class CoreNetwork(CoreNetworkBase):
netem += ["loss", "%s%%" % min(loss, 100)]
if duplicate is not None and duplicate > 0:
netem += ["duplicate", "%s%%" % min(duplicate, 100)]
if delay <= 0 and jitter <= 0 and loss <= 0 and duplicate <= 0:
delay_check = delay is None or delay <= 0
jitter_check = jitter is None or jitter <= 0
loss_check = loss is None or loss <= 0
duplicate_check = duplicate is None or duplicate <= 0
if all([delay_check, jitter_check, loss_check, duplicate_check]):
# possibly remove netem if it exists and parent queue wasn't removed
if not netif.getparam("has_netem"):
return