2017-03-26 03:16:52 +02:00
|
|
|
#! /usr/bin/python3
|
|
|
|
import os
|
|
|
|
import collections
|
|
|
|
|
|
|
|
wiphy_map = {}
|
|
|
|
|
2019-04-20 22:29:01 +02:00
|
|
|
Wiphy = collections.namedtuple('Wiphy', ['name', 'use', 'interface_map'])
|
|
|
|
|
2017-03-26 03:16:52 +02:00
|
|
|
Intf = collections.namedtuple('Intf',
|
2019-04-20 22:29:01 +02:00
|
|
|
['name', 'wiphy', 'ctrl_interface', 'config'])
|
2017-03-26 03:16:52 +02:00
|
|
|
|
|
|
|
def parse_list():
|
|
|
|
for entry in os.environ['TEST_WIPHY_LIST'].split('\n'):
|
2019-04-20 22:29:01 +02:00
|
|
|
wname, use_str = entry.split('=', 1)
|
|
|
|
use = use_str.split(',')
|
2017-03-26 03:16:52 +02:00
|
|
|
|
|
|
|
if wname not in wiphy_map:
|
2019-04-20 22:29:01 +02:00
|
|
|
wiphy_map[wname] = Wiphy(use=use[0], name=wname, interface_map={})
|
2017-03-26 03:16:52 +02:00
|
|
|
|
2019-04-20 22:29:01 +02:00
|
|
|
if len(use) <= 1:
|
|
|
|
continue
|
2017-03-26 03:16:52 +02:00
|
|
|
|
|
|
|
intf = {}
|
2019-04-20 22:29:01 +02:00
|
|
|
intf['name'] = None
|
|
|
|
intf['wiphy'] = wiphy_map[wname]
|
2017-03-26 03:16:52 +02:00
|
|
|
intf['ctrl_interface'] = None
|
|
|
|
intf['config'] = None
|
|
|
|
intf.update(dict([param.split('=', 1) for param in use[1:]]))
|
|
|
|
|
2019-04-20 22:29:01 +02:00
|
|
|
wiphy_map[wname].interface_map[intf['name']] = Intf(**intf)
|
2017-03-26 03:16:52 +02:00
|
|
|
|
|
|
|
parse_list()
|