utils.py 581 B

123456789101112131415161718192021
  1. # Testing utilities
  2. # Copyright (c) 2013-2015, Jouni Malinen <j@w1.fi>
  3. #
  4. # This software may be distributed under the terms of the BSD license.
  5. # See README for more details.
  6. def get_ifnames():
  7. ifnames = []
  8. with open("/proc/net/dev", "r") as f:
  9. lines = f.readlines()
  10. for l in lines:
  11. val = l.split(':', 1)
  12. if len(val) == 2:
  13. ifnames.append(val[0].strip(' '))
  14. return ifnames
  15. class HwsimSkip(Exception):
  16. def __init__(self, reason):
  17. self.reason = reason
  18. def __str__(self):
  19. return self.reason