From 76339a8184f7cc062d1b6d65717153b83d991f4a Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Sun, 26 Mar 2017 03:16:52 +0200 Subject: [PATCH] autotests: Add utility script to parse interface configuration --- autotests/util/wiphy.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 autotests/util/wiphy.py diff --git a/autotests/util/wiphy.py b/autotests/util/wiphy.py new file mode 100644 index 00000000..c9ac1d2b --- /dev/null +++ b/autotests/util/wiphy.py @@ -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()