test-network: read link attribute at any depth

This commit is contained in:
Dan Streetman 2019-10-31 10:15:53 -04:00
parent 9dfc1a9339
commit befd4b8b60
1 changed files with 2 additions and 2 deletions

View File

@ -216,8 +216,8 @@ def tearDownModule():
for u in running_units:
check_output(f'systemctl start {u}')
def read_link_attr(link, dev, attribute):
with open(os.path.join(os.path.join(os.path.join('/sys/class/net/', link), dev), attribute)) as f:
def read_link_attr(*args):
with open(os.path.join('/sys/class/net/', *args)) as f:
return f.readline().strip()
def read_bridge_port_attr(bridge, link, attribute):