mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-23 22:42:37 +01:00
autotests: Add utility script to parse interface configuration
This commit is contained in:
parent
80ac510be0
commit
76339a8184
29
autotests/util/wiphy.py
Normal file
29
autotests/util/wiphy.py
Normal file
@ -0,0 +1,29 @@
|
||||
#! /usr/bin/python3
|
||||
import os
|
||||
import collections
|
||||
|
||||
wiphy_map = {}
|
||||
|
||||
Intf = collections.namedtuple('Intf',
|
||||
['name', 'use', 'ctrl_interface', 'config'])
|
||||
|
||||
def parse_list():
|
||||
for entry in os.environ['TEST_WIPHY_LIST'].split('\n'):
|
||||
wname, ifname, use_str = entry.split('=', 2)
|
||||
|
||||
if wname not in wiphy_map:
|
||||
wiphy_map[wname] = {}
|
||||
wiphy = wiphy_map[wname]
|
||||
|
||||
use = use_str.split(',')
|
||||
|
||||
intf = {}
|
||||
intf['name'] = ifname
|
||||
intf['use'] = use[0]
|
||||
intf['ctrl_interface'] = None
|
||||
intf['config'] = None
|
||||
intf.update(dict([param.split('=', 1) for param in use[1:]]))
|
||||
|
||||
wiphy[ifname] = Intf(**intf)
|
||||
|
||||
parse_list()
|
Loading…
Reference in New Issue
Block a user