Commit a7e44669 authored by Martín Ferrari's avatar Martín Ferrari

minor changes

parent 9f1d3d08
......@@ -3,6 +3,7 @@
import os, subprocess
__all__ = ["ip_path", "tc_path", "brctl_path", "sysctl_path", "hz"]
__all__ += ["tcpdump_path", "netperf_path"]
__all__ += ["execute", "backticks"]
def _find_bin(name):
......@@ -14,13 +15,23 @@ def _find_bin(name):
except OSError, e:
if e.errno != os.errno.ENOENT:
raise
raise RuntimeError("Cannot find `%s' command, impossible to continue." %
name)
ip_path = _find_bin("ip")
tc_path = _find_bin("tc")
brctl_path = _find_bin("brctl")
sysctl_path = _find_bin("sysctl")
return None
def _find_bin_or_die(name):
r = _find_bin(name)
if not r:
raise RuntimeError("Cannot find `%s' command, impossible to " +
"continue." % name)
return r
ip_path = _find_bin_or_die("ip")
tc_path = _find_bin_or_die("tc")
brctl_path = _find_bin_or_die("brctl")
sysctl_path = _find_bin_or_die("sysctl")
# Optional tools
tcpdump_path = _find_bin("tcpdump")
netperf_path = _find_bin("netperf")
# Seems this is completely bogus. At least, we can assume that the internal HZ
# is bigger than this.
......
......@@ -272,6 +272,8 @@ def _get_if_name(iface):
# XXX: ideally this should be replaced by netlink communication
# Interface handling
# FIXME: try to lower the amount of calls to retrieve data!!
def get_if_data():
"""Gets current interface information. Returns a tuple (byidx, bynam) in
which each element is a dictionary with the same data, but using different
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment