diff options
author | sjiajiax <sunx.jiajia@intel.com> | 2015-05-22 17:04:00 +0800 |
---|---|---|
committer | Marvin Liu <yong.liu@intel.com> | 2015-06-01 16:00:33 +0800 |
commit | f6fa9813f3969e9a0b710fda3edb8734aaab783c (patch) | |
tree | 35710f02f7b257eb8b75374b3cabc054cb9b374a /framework/settings.py | |
parent | 6b1eaf152df4e26c6230e2904b5355d04ba1ff46 (diff) |
Move some general functions from dts.py to utils.py and settings.py
Signed-off-by: sjiajiax <sunx.jiajia@intel.com>
Diffstat (limited to 'framework/settings.py')
-rw-r--r-- | framework/settings.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/framework/settings.py b/framework/settings.py index feb6fa5..2eccc64 100644 --- a/framework/settings.py +++ b/framework/settings.py @@ -48,6 +48,7 @@ NICS = { 'powerville': '8086:1521', 'ophir': '8086:105e', 'niantic': '8086:10fb', + 'niantic_vf': '8086:10ed', 'ironpond': '8086:151c', 'twinpond': '8086:1528', 'twinville': '8086:1512', @@ -77,6 +78,7 @@ DRIVERS = { 'powerville': 'igb', 'ophir': 'igb', 'niantic': 'ixgbe', + 'niantic_vf': 'ixgbevf', 'ironpond': 'ixgbe', 'twinpond': 'ixgbe', 'twinville': 'ixgbe', @@ -137,6 +139,17 @@ Global macro for dts. """ IXIA = "ixia" +""" +The root path of framework configs. +""" +CONFIG_ROOT_PATH = "./conf/" + +""" +The log name seperater. +""" +LOG_NAME_SEP = '.' + + def nic_name_from_type(type): """ strip nic code name by nic type @@ -145,3 +158,33 @@ def nic_name_from_type(type): if nic_type == type: return name return 'Unknown' + + +def get_nic_driver(pci_id): + """ + Return linux driver for specified pci device + """ + driverlist = dict(zip(NICS.values(), DRIVERS.keys())) + try: + driver = DRIVERS[driverlist[pci_id]] + except Exception as e: + driver = None + return driver + + +def accepted_nic(pci_id): + """ + Return True if the pci_id is a known NIC card in the settings file and if + it is selected in the execution file, otherwise it returns False. + """ + if pci_id not in NICS.values(): + return False + + if nic is 'any': + return True + + else: + if pci_id == NICS[nic]: + return True + + return False |