removed vnode client netif stats, since was not being used
This commit is contained in:
parent
d3d70ecc54
commit
223590c8fb
2 changed files with 0 additions and 47 deletions
|
@ -236,47 +236,3 @@ class VnodeClient(object):
|
||||||
:rtype: tuple[int, str]
|
:rtype: tuple[int, str]
|
||||||
"""
|
"""
|
||||||
return self.cmd_output([sh, "-c", cmd])
|
return self.cmd_output([sh, "-c", cmd])
|
||||||
|
|
||||||
def netifstats(self, ifname=None):
|
|
||||||
"""
|
|
||||||
Retrieve network interface state.
|
|
||||||
|
|
||||||
:param str ifname: name of interface to get state for
|
|
||||||
:return: interface state information
|
|
||||||
:rtype: dict
|
|
||||||
"""
|
|
||||||
stats = {}
|
|
||||||
args = ["cat", "/proc/net/dev"]
|
|
||||||
p, stdin, stdout, stderr = self.popen(args)
|
|
||||||
stdin.close()
|
|
||||||
# ignore first line
|
|
||||||
stdout.readline()
|
|
||||||
# second line has count names
|
|
||||||
tmp = stdout.readline().decode("utf-8").strip().split("|")
|
|
||||||
rxkeys = tmp[1].split()
|
|
||||||
txkeys = tmp[2].split()
|
|
||||||
for line in stdout:
|
|
||||||
line = line.decode("utf-8").strip().split()
|
|
||||||
devname, tmp = line[0].split(":")
|
|
||||||
if tmp:
|
|
||||||
line.insert(1, tmp)
|
|
||||||
stats[devname] = {"rx": {}, "tx": {}}
|
|
||||||
field = 1
|
|
||||||
for count in rxkeys:
|
|
||||||
stats[devname]["rx"][count] = int(line[field])
|
|
||||||
field += 1
|
|
||||||
for count in txkeys:
|
|
||||||
stats[devname]["tx"][count] = int(line[field])
|
|
||||||
field += 1
|
|
||||||
err = stderr.read()
|
|
||||||
stdout.close()
|
|
||||||
stderr.close()
|
|
||||||
status = p.wait()
|
|
||||||
if status:
|
|
||||||
logging.warning("nonzero exist status (%s) for cmd: %s", status, args)
|
|
||||||
if err:
|
|
||||||
logging.warning("error output: %s", err)
|
|
||||||
if ifname is not None:
|
|
||||||
return stats[ifname]
|
|
||||||
else:
|
|
||||||
return stats
|
|
||||||
|
|
|
@ -126,9 +126,6 @@ class TestCore:
|
||||||
# check module methods
|
# check module methods
|
||||||
assert createclients(session.session_dir)
|
assert createclients(session.session_dir)
|
||||||
|
|
||||||
# check convenience methods for interface information
|
|
||||||
assert client.netifstats()
|
|
||||||
|
|
||||||
def test_netif(self, session, ip_prefixes):
|
def test_netif(self, session, ip_prefixes):
|
||||||
"""
|
"""
|
||||||
Test netif methods.
|
Test netif methods.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue