[style] update python style to conform to PEP 8 (#3951)

With the exception of line length set to 119 vs. 79.

Add tests/ and tools/ to py-pretty-check.
This commit is contained in:
Jonathan Hui
2019-07-11 11:45:55 -04:00
committed by GitHub
parent a938ee2845
commit f924adcb60
341 changed files with 8702 additions and 4460 deletions
@@ -27,17 +27,17 @@
# POSSIBILITY OF SUCH DAMAGE.
#
class FailError(Exception):
"""This error class is the base for all errors that cause the current test case fails.
"""
pass
class FatalError(FailError):
"""This error class is the base for all errors that cause the whole test procedure stops.
"""
pass
class GoldenDeviceNotEnoughError(FailError):
"""Raised when no more golden devices are available for trying.
"""
pass
@@ -36,6 +36,9 @@ import re
import time
import unittest
from builtins import input
from functools import reduce
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.support.ui import Select
@@ -43,7 +46,11 @@ from selenium.common.exceptions import UnexpectedAlertPresentException
from selenium.common.exceptions import NoSuchElementException
from autothreadharness import settings
from autothreadharness.exceptions import FailError, FatalError, GoldenDeviceNotEnoughError
from autothreadharness.exceptions import (
FailError,
FatalError,
GoldenDeviceNotEnoughError,
)
from autothreadharness.harness_controller import HarnessController
from autothreadharness.helpers import HistoryHelper
from autothreadharness.open_thread_controller import OpenThreadController
@@ -61,6 +68,7 @@ THREAD_CHANNEL_MIN = 11
DEFAULT_TIMEOUT = 2700
"""Timeout for each test case in seconds"""
def wait_until(what, times=-1):
"""Wait until `what` return True
@@ -77,7 +85,7 @@ def wait_until(what, times=-1):
try:
if what() is True:
return True
except:
except BaseException:
logger.exception('Wait failed')
else:
logger.warning('Trial[%d] failed', times)
@@ -86,6 +94,7 @@ def wait_until(what, times=-1):
return False
class HarnessCase(unittest.TestCase):
"""This is the case class of all automation test cases.
@@ -98,16 +107,16 @@ class HarnessCase(unittest.TestCase):
Thread channel ranges from 11 to 26.
"""
ROLE_LEADER = 1
ROLE_ROUTER = 2
ROLE_SED = 4
ROLE_BORDER = 8
ROLE_REED = 16
ROLE_ED = 32
ROLE_COMMISSIONER = 64
ROLE_JOINER = 128
ROLE_FED = 512
ROLE_MED = 1024
ROLE_LEADER = 1
ROLE_ROUTER = 2
ROLE_SED = 4
ROLE_BORDER = 8
ROLE_REED = 16
ROLE_ED = 32
ROLE_COMMISSIONER = 64
ROLE_JOINER = 128
ROLE_FED = 512
ROLE_MED = 1024
role = None
"""int: role id.
@@ -151,7 +160,9 @@ class HarnessCase(unittest.TestCase):
auto_dut = settings.AUTO_DUT
"""bool: whether use harness auto dut feature"""
timeout = hasattr(settings, 'TIMEOUT') and settings.TIMEOUT or DEFAULT_TIMEOUT
timeout = (
hasattr(settings, 'TIMEOUT') and settings.TIMEOUT or DEFAULT_TIMEOUT
)
"""number: timeout in seconds to stop running this test case"""
started = 0
@@ -161,7 +172,10 @@ class HarnessCase(unittest.TestCase):
self.dut = None
self._browser = None
self._hc = None
self.result_dir = '%s\\%s' % (settings.OUTPUT_PATH, self.__class__.__name__)
self.result_dir = '%s\\%s' % (
settings.OUTPUT_PATH,
self.__class__.__name__,
)
self.history = HistoryHelper()
self.add_all_devices = False
@@ -183,7 +197,7 @@ class HarnessCase(unittest.TestCase):
with OpenThreadController(port) as otc:
logger.info('Resetting %s', port)
otc.reset()
except:
except BaseException:
logger.exception('Failed to reset device %s', port)
self.history.mark_bad_golden_device(device)
@@ -194,7 +208,9 @@ class HarnessCase(unittest.TestCase):
while True:
try:
pdu = pdu_factory.create_pdu_controller(settings.PDU_CONTROLLER_TYPE)
pdu = pdu_factory.create_pdu_controller(
settings.PDU_CONTROLLER_TYPE
)
pdu.open(**settings.PDU_CONTROLLER_OPEN_PARAMS)
except EOFError:
logger.warning('Failed to connect to telnet')
@@ -224,16 +240,32 @@ class HarnessCase(unittest.TestCase):
time.sleep(2)
harness_config = ConfigParser.ConfigParser()
harness_config.read('%s\\Config\\Configuration.ini' % settings.HARNESS_HOME)
if harness_config.has_option('THREAD_HARNESS_CONFIG', 'BrowserAutoNavigate') and \
harness_config.getboolean('THREAD_HARNESS_CONFIG', 'BrowserAutoNavigate'):
logger.error('BrowserAutoNavigate in Configuration.ini should be False')
raise FailError('BrowserAutoNavigate in Configuration.ini should be False')
harness_config.read(
'%s\\Config\\Configuration.ini' % settings.HARNESS_HOME
)
if harness_config.has_option(
'THREAD_HARNESS_CONFIG', 'BrowserAutoNavigate'
) and harness_config.getboolean(
'THREAD_HARNESS_CONFIG', 'BrowserAutoNavigate'
):
logger.error(
'BrowserAutoNavigate in Configuration.ini should be False'
)
raise FailError(
'BrowserAutoNavigate in Configuration.ini should be False'
)
if settings.MIXED_DEVICE_TYPE:
if harness_config.has_option('THREAD_HARNESS_CONFIG', 'EnableDeviceSelection') and \
not harness_config.getboolean('THREAD_HARNESS_CONFIG', 'EnableDeviceSelection'):
logger.error('EnableDeviceSelection in Configuration.ini should be True')
raise FailError('EnableDeviceSelection in Configuration.ini should be True')
if harness_config.has_option(
'THREAD_HARNESS_CONFIG', 'EnableDeviceSelection'
) and not harness_config.getboolean(
'THREAD_HARNESS_CONFIG', 'EnableDeviceSelection'
):
logger.error(
'EnableDeviceSelection in Configuration.ini should be True'
)
raise FailError(
'EnableDeviceSelection in Configuration.ini should be True'
)
def _destroy_harness(self):
"""Stop harness backend service
@@ -271,9 +303,10 @@ class HarnessCase(unittest.TestCase):
chrome_options.add_argument('--disable-extensions')
chrome_options.add_argument('--disable-infobars')
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_experimental_option('prefs', {
'profile.managed_default_content_settings.notifications': 1
})
chrome_options.add_experimental_option(
'prefs',
{'profile.managed_default_content_settings.notifications': 1},
)
browser = webdriver.Chrome(chrome_options=chrome_options)
browser.set_page_load_timeout(10)
@@ -291,10 +324,12 @@ class HarnessCase(unittest.TestCase):
self._browser = None
def _init_rf_shield(self):
if getattr(settings, 'SHIELD_CONTROLLER_TYPE', None) and getattr(settings, 'SHIELD_CONTROLLER_PARAMS', None):
if getattr(settings, 'SHIELD_CONTROLLER_TYPE', None) and getattr(
settings, 'SHIELD_CONTROLLER_PARAMS', None
):
self.rf_shield = get_rf_shield_controller(
shield_type=settings.SHIELD_CONTROLLER_TYPE,
params=settings.SHIELD_CONTROLLER_PARAMS
params=settings.SHIELD_CONTROLLER_PARAMS,
)
else:
self.rf_shield = None
@@ -315,13 +350,17 @@ class HarnessCase(unittest.TestCase):
logger.info('Deleting all .pdf')
os.system('del /q "%HOMEDRIVE%%HOMEPATH%\\Downloads\\NewPdf_*.pdf"')
logger.info('Deleting all .xlsx')
os.system('del /q "%HOMEDRIVE%%HOMEPATH%\\Downloads\\ExcelReport*.xlsx"')
os.system(
'del /q "%HOMEDRIVE%%HOMEPATH%\\Downloads\\ExcelReport*.xlsx"'
)
logger.info('Deleting all .pcapng')
os.system('del /q "%s\\Captures\\*.pcapng"' % settings.HARNESS_HOME)
# using temp files to fix excel downloading fail
logger.info('Empty files in temps')
os.system('del /q "%s\\Thread_Harness\\temp\\*.*"' % settings.HARNESS_HOME)
os.system(
'del /q "%s\\Thread_Harness\\temp\\*.*"' % settings.HARNESS_HOME
)
# create directory
os.system('mkdir %s' % self.result_dir)
@@ -350,33 +389,41 @@ class HarnessCase(unittest.TestCase):
if not self.started:
self.started = time.time()
if time.time() - self.started > 5*len(settings.GOLDEN_DEVICES):
if time.time() - self.started > 5 * len(settings.GOLDEN_DEVICES):
self._browser.refresh()
return
# Detect Sniffer
try:
dialog = self._browser.find_element_by_id('capture-Setup-modal')
except:
except BaseException:
logger.exception('Failed to get dialog.')
else:
if dialog and dialog.get_attribute('aria-hidden') == 'false':
times = 100
while times:
status = dialog.find_element_by_class_name('status-notify').text
status = dialog.find_element_by_class_name(
'status-notify'
).text
if 'Searching' in status:
logger.info('Still detecting..')
elif 'Not' in status:
logger.warning('Sniffer device not verified!')
button = dialog.find_element_by_id('snifferAutoDetectBtn')
button = dialog.find_element_by_id(
'snifferAutoDetectBtn'
)
button.click()
elif 'Verified' in status:
logger.info('Verified!')
button = dialog.find_element_by_id('saveCaptureSettings')
button = dialog.find_element_by_id(
'saveCaptureSettings'
)
button.click()
break
else:
logger.warning('Unexpected sniffer verification status')
logger.warning(
'Unexpected sniffer verification status'
)
times = times - 1
time.sleep(1)
@@ -391,12 +438,12 @@ class HarnessCase(unittest.TestCase):
if skip_button.is_enabled():
skip_button.click()
time.sleep(1)
except:
except BaseException:
logger.info('Still detecting sniffers')
try:
next_button = self._browser.find_element_by_id('nextButton')
except:
except BaseException:
logger.exception('Failed to finish setup')
return
@@ -412,16 +459,22 @@ class HarnessCase(unittest.TestCase):
button.click()
time.sleep(2)
dialog = self._browser.find_element_by_id('general-Setup-modal')
dialog = self._browser.find_element_by_id(
'general-Setup-modal'
)
if dialog.get_attribute('aria-hidden') != 'false':
raise Exception('Missing General Setup dialog')
field = dialog.find_element_by_id('inp_general_child_update_wait_time')
field = dialog.find_element_by_id(
'inp_general_child_update_wait_time'
)
field.clear()
if self.child_timeout:
field.send_keys(str(self.child_timeout))
field = dialog.find_element_by_id('inp_general_sed_polling_rate')
field = dialog.find_element_by_id(
'inp_general_sed_polling_rate'
)
field.clear()
if self.sed_polling_interval:
field.send_keys(str(self.sed_polling_interval))
@@ -430,7 +483,7 @@ class HarnessCase(unittest.TestCase):
button.click()
time.sleep(1)
except:
except BaseException:
logger.info('general setup exception')
logger.exception('Failed to do general setup')
return
@@ -478,28 +531,39 @@ class HarnessCase(unittest.TestCase):
selected_hw_num = len(selected_hw_set)
while selected_hw_num:
remove_button = selected_hw_set[selected_hw_num - 1].find_element_by_class_name(
'removeSelectedDevice')
remove_button = selected_hw_set[
selected_hw_num - 1
].find_element_by_class_name('removeSelectedDevice')
remove_button.click()
selected_hw_num = selected_hw_num - 1
devices = [device for device in settings.GOLDEN_DEVICES
if not self.history.is_bad_golden_device(device[0]) and \
not (settings.DUT_DEVICE and device[0] == settings.DUT_DEVICE[0])]
logger.info('Available golden devices: %s', json.dumps(devices, indent=2))
devices = [
device
for device in settings.GOLDEN_DEVICES
if not self.history.is_bad_golden_device(device[0])
and not (
settings.DUT_DEVICE and device[0] == settings.DUT_DEVICE[0]
)
]
logger.info(
'Available golden devices: %s', json.dumps(devices, indent=2)
)
golden_devices_required = self.golden_devices_required
# for test bed with mixed devices
if settings.MIXED_DEVICE_TYPE:
topo_file = settings.HARNESS_HOME+"\\Thread_Harness\\TestScripts\\TopologyConfig.txt"
topo_file = (
settings.HARNESS_HOME
+ "\\Thread_Harness\\TestScripts\\TopologyConfig.txt"
)
try:
f_topo = open(topo_file, 'r')
except IOError as e:
except IOError:
logger.info('%s can NOT be found', topo_file)
raise GoldenDeviceNotEnoughError()
topo_mixed_devices = []
try:
while 1:
while True:
topo_line = f_topo.readline().strip()
if re.match(r'#.*', topo_line):
continue
@@ -509,7 +573,9 @@ class HarnessCase(unittest.TestCase):
case_id = match_line.group(1)
if re.sub(r'\.', ' ', case_id) == self.case:
logger.info('Get line by case %s: %s', case_id, topo_line)
logger.info(
'Get line by case %s: %s', case_id, topo_line
)
topo_device_list = re.split(',', match_line.group(2))
for i in range(len(topo_device_list)):
topo_device = re.split(':', topo_device_list[i])
@@ -518,9 +584,15 @@ class HarnessCase(unittest.TestCase):
else:
continue
except Exception as e:
logger.info('Get devices from topology config file error: %s', e)
logger.info(
'Get devices from topology config file error: %s', e
)
raise GoldenDeviceNotEnoughError()
logger.info('Golden devices in topology config file for case %s: %s', case_id, topo_mixed_devices)
logger.info(
'Golden devices in topology config file for case %s: %s',
case_id,
topo_mixed_devices,
)
f_topo.close()
golden_device_candidates = []
missing_golden_devices = topo_mixed_devices[:]
@@ -532,7 +604,10 @@ class HarnessCase(unittest.TestCase):
devices.remove(device_item)
missing_golden_devices.remove(mixed_device_item)
break
logger.info('Golden devices in topology config file mapped in settings : %s', golden_device_candidates)
logger.info(
'Golden devices in topology config file mapped in settings : %s',
golden_device_candidates,
)
if len(topo_mixed_devices) != len(golden_device_candidates):
device_dict = dict()
for missing_device in missing_golden_devices:
@@ -545,7 +620,10 @@ class HarnessCase(unittest.TestCase):
else:
devices = golden_device_candidates
golden_devices_required = len(devices)
logger.info('All case-needed golden devices: %s', json.dumps(devices, indent=2))
logger.info(
'All case-needed golden devices: %s',
json.dumps(devices, indent=2),
)
if self.auto_dut and not settings.DUT_DEVICE:
if settings.MIXED_DEVICE_TYPE:
@@ -557,7 +635,9 @@ class HarnessCase(unittest.TestCase):
raise GoldenDeviceNotEnoughError()
# add golden devices
number_of_devices_to_add = len(devices) if self.add_all_devices else golden_devices_required
number_of_devices_to_add = (
len(devices) if self.add_all_devices else golden_devices_required
)
for i in range(number_of_devices_to_add):
self._add_device(*devices.pop())
@@ -567,13 +647,17 @@ class HarnessCase(unittest.TestCase):
# enable AUTO DUT
if self.auto_dut:
checkbox_auto_dut = browser.find_element_by_id('EnableAutoDutSelection')
checkbox_auto_dut = browser.find_element_by_id(
'EnableAutoDutSelection'
)
if not checkbox_auto_dut.is_selected():
checkbox_auto_dut.click()
time.sleep(1)
if settings.DUT_DEVICE:
radio_auto_dut = browser.find_element_by_class_name('AutoDUT_RadBtns')
radio_auto_dut = browser.find_element_by_class_name(
'AutoDUT_RadBtns'
)
if not radio_auto_dut.is_selected():
radio_auto_dut.click()
@@ -581,23 +665,36 @@ class HarnessCase(unittest.TestCase):
try:
self._connect_devices()
button_next = browser.find_element_by_id('nextBtn')
if not wait_until(lambda: 'disabled' not in button_next.get_attribute('class'),
times=(30 + 4 * number_of_devices_to_add)):
if not wait_until(
lambda: 'disabled'
not in button_next.get_attribute('class'),
times=(30 + 4 * number_of_devices_to_add),
):
bad_ones = []
selected_hw_set = test_bed.find_elements_by_class_name('selected-hw')
selected_hw_set = test_bed.find_elements_by_class_name(
'selected-hw'
)
for selected_hw in selected_hw_set:
form_inputs = selected_hw.find_elements_by_tag_name('input')
form_inputs = selected_hw.find_elements_by_tag_name(
'input'
)
form_port = form_inputs[0]
if form_port.is_enabled():
bad_ones.append(selected_hw)
for selected_hw in bad_ones:
form_inputs = selected_hw.find_elements_by_tag_name('input')
form_inputs = selected_hw.find_elements_by_tag_name(
'input'
)
form_port = form_inputs[0]
port = form_port.get_attribute('value').encode('utf8')
if settings.DUT_DEVICE and port == settings.DUT_DEVICE[0]:
if (
settings.DUT_DEVICE
and port == settings.DUT_DEVICE[0]
):
if settings.PDU_CONTROLLER_TYPE is None:
# connection error cannot recover without power cycling
# connection error cannot recover without power
# cycling
raise FatalError('Failed to connect to DUT')
else:
raise FailError('Failed to connect to DUT')
@@ -607,7 +704,9 @@ class HarnessCase(unittest.TestCase):
self.history.mark_bad_golden_device(port)
# remove the bad one
selected_hw.find_element_by_class_name('removeSelectedDevice').click()
selected_hw.find_element_by_class_name(
'removeSelectedDevice'
).click()
time.sleep(0.1)
if len(devices):
@@ -623,18 +722,25 @@ class HarnessCase(unittest.TestCase):
continue
if self.auto_dut and not settings.DUT_DEVICE:
radio_auto_dut = browser.find_element_by_class_name('AutoDUT_RadBtns')
radio_auto_dut = browser.find_element_by_class_name(
'AutoDUT_RadBtns'
)
if not radio_auto_dut.is_selected():
radio_auto_dut.click()
time.sleep(5)
button_next.click()
if not wait_until(lambda: self._browser.current_url.endswith('TestExecution.html'), 20):
if not wait_until(
lambda: self._browser.current_url.endswith(
'TestExecution.html'
),
20,
):
raise Exception('Failed to load TestExecution page')
except FailError:
raise
except:
except BaseException:
logger.exception('Unexpected error')
else:
break
@@ -648,8 +754,15 @@ class HarnessCase(unittest.TestCase):
time.sleep(1)
checkbox = None
wait_until(lambda: self._browser.find_elements_by_css_selector('.tree-node .tree-title') and True)
elems = self._browser.find_elements_by_css_selector('.tree-node .tree-title')
wait_until(
lambda: self._browser.find_elements_by_css_selector(
'.tree-node .tree-title'
)
and True
)
elems = self._browser.find_elements_by_css_selector(
'.tree-node .tree-title'
)
finder = re.compile(r'.*\b' + case + r'\b')
finder_dotted = re.compile(r'.*\b' + case.replace(' ', r'\.') + r'\b')
for elem in elems:
@@ -672,7 +785,9 @@ class HarnessCase(unittest.TestCase):
elem = self._browser.find_element_by_id('runTest')
elem.click()
if not wait_until(lambda: self._browser.find_element_by_id('stopTest') and True, 10):
if not wait_until(
lambda: self._browser.find_element_by_id('stopTest') and True, 10
):
raise Exception('Failed to start test case')
def _collect_result(self):
@@ -685,17 +800,27 @@ class HarnessCase(unittest.TestCase):
time.sleep(1)
try:
dialog = self._browser.find_element_by_id('Testinfo')
except:
except BaseException:
logger.exception('Failed to get test info dialog.')
else:
if dialog.get_attribute('aria-hidden') != 'false':
raise Exception('Test information dialog not ready')
version = self.auto_dut and settings.DUT_VERSION or self.dut.version
dialog.find_element_by_id('inp_dut_manufacturer').send_keys(settings.DUT_MANUFACTURER)
dialog.find_element_by_id('inp_dut_firmware_version').send_keys(version)
dialog.find_element_by_id('inp_tester_name').send_keys(settings.TESTER_NAME)
dialog.find_element_by_id('inp_remarks').send_keys(settings.TESTER_REMARKS)
version = (
self.auto_dut and settings.DUT_VERSION or self.dut.version
)
dialog.find_element_by_id('inp_dut_manufacturer').send_keys(
settings.DUT_MANUFACTURER
)
dialog.find_element_by_id('inp_dut_firmware_version').send_keys(
version
)
dialog.find_element_by_id('inp_tester_name').send_keys(
settings.TESTER_NAME
)
dialog.find_element_by_id('inp_remarks').send_keys(
settings.TESTER_REMARKS
)
dialog.find_element_by_id('generatePdf').click()
time.sleep(1)
@@ -719,14 +844,22 @@ class HarnessCase(unittest.TestCase):
self._browser.close()
self._browser.switch_to.window(main_window)
os.system('copy "%%HOMEPATH%%\\Downloads\\NewPdf_*.pdf" %s\\'
% self.result_dir)
os.system('copy "%%HOMEPATH%%\\Downloads\\ExcelReport_*.xlsx" %s\\'
% self.result_dir)
os.system('copy "%s\\Captures\\*.pcapng" %s\\'
% (settings.HARNESS_HOME, self.result_dir))
os.system('copy "%s\\Thread_Harness\\temp\\*.*" "%s"'
% (settings.HARNESS_HOME, self.result_dir))
os.system(
'copy "%%HOMEPATH%%\\Downloads\\NewPdf_*.pdf" %s\\'
% self.result_dir
)
os.system(
'copy "%%HOMEPATH%%\\Downloads\\ExcelReport_*.xlsx" %s\\'
% self.result_dir
)
os.system(
'copy "%s\\Captures\\*.pcapng" %s\\'
% (settings.HARNESS_HOME, self.result_dir)
)
os.system(
'copy "%s\\Thread_Harness\\temp\\*.*" "%s"'
% (settings.HARNESS_HOME, self.result_dir)
)
def _wait_dialog(self):
"""Wait for dialogs and handle them until done.
@@ -735,21 +868,23 @@ class HarnessCase(unittest.TestCase):
done = False
error = False
logger.info("self timeout %d",self.timeout)
logger.info("self timeout %d", self.timeout)
while not done and self.timeout:
try:
dialog = self._browser.find_element_by_id('RemoteConfirm')
except:
except BaseException:
logger.exception('Failed to get dialog.')
else:
if dialog and dialog.get_attribute('aria-hidden') == 'false':
title = dialog.find_element_by_class_name('modal-title').text
title = dialog.find_element_by_class_name(
'modal-title'
).text
time.sleep(1)
logger.info('Handling dialog[%s]', title)
try:
done = self._handle_dialog(dialog, title)
except:
except BaseException:
logger.exception('Error handling dialog: %s', title)
error = True
@@ -777,14 +912,25 @@ class HarnessCase(unittest.TestCase):
if self.timeout % 10 == 0:
lines = self._hc.tail()
if 'SUCCESS: The process "dumpcap.exe" with PID ' in lines:
logger.info('Tshark should be ended now, lets wait at most 30 seconds.')
if not wait_until(lambda: 'tshark.exe' not in subprocess.check_output('tasklist'), 30):
res = subprocess.check_output('taskkill /t /f /im tshark.exe',
stderr=subprocess.STDOUT, shell=True)
logger.info(
'Tshark should be ended now, lets wait at most 30 seconds.'
)
if not wait_until(
lambda: 'tshark.exe'
not in subprocess.check_output('tasklist'),
30,
):
res = subprocess.check_output(
'taskkill /t /f /im tshark.exe',
stderr=subprocess.STDOUT,
shell=True,
)
logger.info(res)
# Wait until case really stopped
wait_until(lambda: self._browser.find_element_by_id('runTest') and True, 30)
wait_until(
lambda: self._browser.find_element_by_id('runTest') and True, 30
)
if error:
raise FailError('Fail for previous exceptions')
@@ -821,8 +967,9 @@ class HarnessCase(unittest.TestCase):
self.dut.extpanid = settings.THREAD_EXTPANID
self.dut.start()
elif (title.startswith('MAC Address Required')
or title.startswith('DUT Random Extended MAC Address Required')):
elif title.startswith('MAC Address Required') or title.startswith(
'DUT Random Extended MAC Address Required'
):
mac = self.dut.mac
inp = dialog.find_element_by_id('cnfrmInpText')
inp.clear()
@@ -832,7 +979,9 @@ class HarnessCase(unittest.TestCase):
ll64 = None
for addr in self.dut.addrs:
addr = addr.lower()
if addr.startswith('fe80') and not re.match('.+ff:fe00:[0-9a-f]{0,4}$', addr):
if addr.startswith('fe80') and not re.match(
'.+ff:fe00:[0-9a-f]{0,4}$', addr
):
ll64 = addr
break
@@ -865,7 +1014,9 @@ class HarnessCase(unittest.TestCase):
elif title.startswith('ML64 Address'):
ml64 = None
for addr in self.dut.addrs:
if addr.startswith('fd') and not re.match('.+ff:fe00:[0-9a-f]{0,4}$', addr):
if addr.startswith('fd') and not re.match(
'.+ff:fe00:[0-9a-f]{0,4}$', addr
):
ml64 = addr
break
@@ -877,18 +1028,23 @@ class HarnessCase(unittest.TestCase):
inp.clear()
inp.send_keys(ml64)
elif title.startswith('Shield Devices') or title.startswith('Sheild DUT'):
elif title.startswith('Shield Devices') or title.startswith(
'Sheild DUT'
):
if self.rf_shield:
logger.info('Shielding devices')
with self.rf_shield:
self.rf_shield.shield()
elif self.dut and settings.SHIELD_SIMULATION:
self.dut.channel = (self.channel == THREAD_CHANNEL_MAX
and THREAD_CHANNEL_MIN) or (self.channel + 1)
self.dut.channel = (
self.channel == THREAD_CHANNEL_MAX and THREAD_CHANNEL_MIN
) or (self.channel + 1)
else:
raw_input('Shield DUT and press enter to continue..')
input('Shield DUT and press enter to continue..')
elif title.startswith('Unshield Devices') or title.startswith('Bring DUT Back to network'):
elif title.startswith('Unshield Devices') or title.startswith(
'Bring DUT Back to network'
):
if self.rf_shield:
logger.info('Unshielding devices')
with self.rf_shield:
@@ -896,13 +1052,19 @@ class HarnessCase(unittest.TestCase):
elif self.dut and settings.SHIELD_SIMULATION:
self.dut.channel = self.channel
else:
raw_input('Bring DUT and press enter to continue..')
input('Bring DUT and press enter to continue..')
elif title.startswith('Configure Prefix on DUT'):
body = dialog.find_element_by_id('cnfrmMsg').text
body = body.split(': ')[1]
params = reduce(lambda params, param: params.update(((param[0].strip(' '), param[1]),)) or params,
[it.split('=') for it in body.split(', ')], {})
params = reduce(
lambda params, param: params.update(
((param[0].strip(' '), param[1]),)
)
or params,
[it.split('=') for it in body.split(', ')],
{},
)
prefix = params['P_Prefix'].strip('\0\r\n\t ')
flags = []
if params.get('P_slaac_preferred', 0) == '1':
@@ -946,7 +1108,7 @@ class HarnessCase(unittest.TestCase):
except FailError:
logger.exception('Test failed')
raise
except:
except BaseException:
logger.exception('Something wrong')
self._select_case(self.role, self.case)
@@ -956,7 +1118,7 @@ class HarnessCase(unittest.TestCase):
try:
self._collect_result()
except:
except BaseException:
logger.exception('Failed to collect results')
raise
@@ -41,6 +41,7 @@ logger = logging.getLogger(__name__)
HARNESS_SVN_VERSION_R44 = 1471
"""int: this is the first published release that miniweb was removed from Harness"""
def _try_kill(proc):
logger.info('Try kill process')
times = 1
@@ -60,11 +61,13 @@ def _try_kill(proc):
if times > 3:
raise SystemExit()
class HarnessController(object):
"""Harness service control
This controls harness service, including the harness back-end and front-end.
"""
harness = None
"""harness back-end"""
@@ -84,17 +87,27 @@ class HarnessController(object):
if self.harness:
logger.warning('Harness already started')
else:
env = dict(os.environ, PYTHONPATH='%s\\Thread_Harness;%s\\ThirdParty\\hsdk-python\\src'
% (settings.HARNESS_HOME, settings.HARNESS_HOME))
env = dict(
os.environ,
PYTHONPATH='%s\\Thread_Harness;%s\\ThirdParty\\hsdk-python\\src'
% (settings.HARNESS_HOME, settings.HARNESS_HOME),
)
self.harness_file = '%s\\harness-%s.log' % (self.result_dir, time.strftime('%Y%m%d%H%M%S'))
self.harness_file = '%s\\harness-%s.log' % (
self.result_dir,
time.strftime('%Y%m%d%H%M%S'),
)
with open(self.harness_file, 'w') as harness_out:
self.harness = subprocess.Popen([settings.HARNESS_HOME + '\\Python27\\python.exe',
settings.HARNESS_HOME + '\\Thread_Harness\\Run.py'],
cwd=settings.HARNESS_HOME,
stdout=harness_out,
stderr=harness_out,
env=env)
self.harness = subprocess.Popen(
[
settings.HARNESS_HOME + '\\Python27\\python.exe',
settings.HARNESS_HOME + '\\Thread_Harness\\Run.py',
],
cwd=settings.HARNESS_HOME,
stdout=harness_out,
stderr=harness_out,
env=env,
)
time.sleep(2)
if self.version >= HARNESS_SVN_VERSION_R44:
@@ -103,11 +116,17 @@ class HarnessController(object):
if self.miniweb:
logger.warning('Miniweb already started')
else:
with open('%s\\miniweb-%s.log' % (self.result_dir, time.strftime('%Y%m%d%H%M%S')), 'w') as miniweb_out:
self.miniweb = subprocess.Popen([settings.HARNESS_HOME + '\\MiniWeb\\miniweb.exe'],
stdout=miniweb_out,
stderr=miniweb_out,
cwd=settings.HARNESS_HOME + '\\MiniWeb')
with open(
'%s\\miniweb-%s.log'
% (self.result_dir, time.strftime('%Y%m%d%H%M%S')),
'w',
) as miniweb_out:
self.miniweb = subprocess.Popen(
[settings.HARNESS_HOME + '\\MiniWeb\\miniweb.exe'],
stdout=miniweb_out,
stderr=miniweb_out,
cwd=settings.HARNESS_HOME + '\\MiniWeb',
)
def stop(self):
logger.info('Stopping harness service')
@@ -41,9 +41,7 @@ class HistoryHelper(object):
self.data = json.load(open(filename, 'r'))
except Exception:
self.logger.exception('file may not exists')
self.data = {
'golden_device_black_list': []
}
self.data = {'golden_device_black_list': []}
self.save()
def save(self):
@@ -43,8 +43,10 @@ logger = logging.getLogger(__name__)
linesepx = re.compile(r'\r\n|\n')
class OpenThreadController(threading.Thread):
"""This is an simple wrapper to communicate with openthread"""
_lock = threading.Lock()
viewing = False
@@ -93,7 +95,9 @@ class OpenThreadController(threading.Thread):
def _connect(self):
logger.debug('My port is %s', self.port)
if self.port.startswith('NET'):
portnum = settings.SER2NET_PORTBASE + int(self.port.split('NET')[1])
portnum = settings.SER2NET_PORTBASE + int(
self.port.split('NET')[1]
)
logger.debug('My port num is %d', portnum)
address = (settings.SER2NET_HOSTNAME, portnum)
self.handle = socket.create_connection(address)
@@ -105,7 +109,9 @@ class OpenThreadController(threading.Thread):
self.handle.setblocking(0)
self._is_net = True
else:
self.handle = serial.Serial(self.port, 115200, timeout=0, xonxoff=True)
self.handle = serial.Serial(
self.port, 115200, timeout=0, xonxoff=True
)
self._is_net = False
def _read(self, size=512):
@@ -223,7 +229,7 @@ class OpenThreadController(threading.Thread):
res.append(line)
break
except:
except BaseException:
logger.exception('Failed to send command')
self.close()
self._init()
@@ -238,7 +244,7 @@ class OpenThreadController(threading.Thread):
while self.viewing and self._lock.acquire():
try:
line = self._readline()
except:
except BaseException:
pass
else:
logger.info(line)
@@ -275,7 +281,6 @@ class OpenThreadController(threading.Thread):
self._read()
self._log and self.resume()
def resume(self):
"""Start dumping logs"""
self._lock.release()
@@ -283,6 +288,7 @@ class OpenThreadController(threading.Thread):
def pause(self):
"""Start dumping logs"""
self._lock.acquire()
@property
def networkname(self):
"""str: Thread network name."""
@@ -33,18 +33,27 @@ import re
import telnetlib
import time
from builtins import input
try:
# python 2
from urllib2 import HTTPPasswordMgrWithDefaultRealm, HTTPBasicAuthHandler, build_opener
from urllib2 import (
HTTPPasswordMgrWithDefaultRealm,
HTTPBasicAuthHandler,
build_opener,
)
except ImportError:
# python 3
from urllib.request import HTTPPasswordMgrWithDefaultRealm, HTTPBasicAuthHandler, build_opener
from urllib.request import (
HTTPPasswordMgrWithDefaultRealm,
HTTPBasicAuthHandler,
build_opener,
)
logger = logging.getLogger(__name__)
class PduController(object):
def open(self, **params):
"""Open PDU controller connection"""
raise NotImplementedError
@@ -72,7 +81,6 @@ class DummyPduController(PduController):
class ApcPduController(PduController):
def __init__(self):
self.tn = None
@@ -170,7 +178,6 @@ class ApcPduController(PduController):
class NordicBoardPduController(PduController):
def open(self, **params):
pass
@@ -181,7 +188,9 @@ class NordicBoardPduController(PduController):
boards_serial_numbers = params['boards_serial_numbers']
for serial_number in boards_serial_numbers:
logger.info('Resetting board with the serial number: %s', serial_number)
logger.info(
'Resetting board with the serial number: %s', serial_number
)
self._pin_reset(serial_number)
def close(self):
@@ -189,11 +198,12 @@ class NordicBoardPduController(PduController):
class IpPowerSocketPduController(PduController):
def open(self, **params):
self._base_url = 'http://{}/outs.cgi?out'.format(params['ip'])
password_manager = HTTPPasswordMgrWithDefaultRealm()
password_manager.add_password(None, self._base_url, params['user'], params['pass'])
password_manager.add_password(
None, self._base_url, params['user'], params['pass']
)
authentication_handler = HTTPBasicAuthHandler(password_manager)
self._opener = build_opener(authentication_handler)
@@ -220,12 +230,11 @@ class IpPowerSocketPduController(PduController):
class ManualPduController(PduController):
def open(self, **kwargs):
pass
def reboot(self, **kwargs):
raw_input('Reset all devices and press enter to continue..')
input('Reset all devices and press enter to continue..')
def close(self):
pass
@@ -39,7 +39,6 @@ logger = logging.getLogger(__name__)
class RfShieldController(ABC):
@abc.abstractmethod
def shield(self):
pass
@@ -58,7 +57,6 @@ class RfShieldController(ABC):
class RfSwitchController(RfShieldController):
def __init__(self, channel, port):
self._channel = channel
self._port = port
@@ -92,12 +90,12 @@ class RfSwitchController(RfShieldController):
self._conn = None
CONTROLLERS = {
'RF_SWITCH': RfSwitchController,
}
CONTROLLERS = {'RF_SWITCH': RfSwitchController}
def get_rf_shield_controller(shield_type, params):
if shield_type in CONTROLLERS:
return CONTROLLERS[shield_type](**params)
logger.exception('Unknown RF shield controller type: {}'.format(shield_type))
logger.exception(
'Unknown RF shield controller type: {}'.format(shield_type)
)
@@ -36,6 +36,7 @@ import os
import sys
import time
import unittest
from builtins import str
from collections import OrderedDict
from autothreadharness.harness_case import HarnessCase
@@ -49,14 +50,23 @@ logger = logging.getLogger()
logger.setLevel(logging.INFO)
RESUME_SCRIPT_PATH = '%appdata%\\Microsoft\\Windows\\Start Menu\\Programs\\' \
'Startup\\continue_harness.bat'
RESUME_SCRIPT_PATH = (
'%appdata%\\Microsoft\\Windows\\Start Menu\\Programs\\'
'Startup\\continue_harness.bat'
)
class SimpleTestResult(unittest.TestResult):
executions = 0
def __init__(self, path, auto_reboot_args=None, keep_explorer=False, add_all_devices=False):
def __init__(
self,
path,
auto_reboot_args=None,
keep_explorer=False,
add_all_devices=False,
):
"""Record test results in json file
Args:
@@ -75,23 +85,37 @@ class SimpleTestResult(unittest.TestResult):
logger.info('Initial state is %s', json.dumps(self.result, indent=2))
def startTest(self, test):
logger.info('\n========================================\n%s\n========================================', test.__class__.__name__)
logger.info(
'\n========================================\n%s\n========================================',
test.__class__.__name__,
)
test.add_all_devices = self.add_all_devices
# create start up script if auto reboot enabled
if self.auto_reboot_args:
test.auto_reboot = True
os.system('echo %s > "%s"'
% (' '.join(self.auto_reboot_args + ['-c', test.__class__.__name__]),
RESUME_SCRIPT_PATH))
os.system(
'echo %s > "%s"'
% (
' '.join(
self.auto_reboot_args + ['-c', test.__class__.__name__]
),
RESUME_SCRIPT_PATH,
)
)
# record start timestamp
self.started = time.strftime('%Y-%m-%dT%H:%M:%S')
os.system('mkdir %s' % test.result_dir)
self.log_handler = logging.FileHandler('%s\\auto-%s.log' % (test.result_dir, time.strftime('%Y%m%d%H%M%S')))
self.log_handler = logging.FileHandler(
'%s\\auto-%s.log'
% (test.result_dir, time.strftime('%Y%m%d%H%M%S'))
)
self.log_handler.setLevel(logging.DEBUG)
self.log_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
self.log_handler.setFormatter(
logging.Formatter('%(asctime)s %(levelname)s %(message)s')
)
logger.addHandler(self.log_handler)
def add_result(self, test, passed, error=None):
@@ -101,18 +125,21 @@ class SimpleTestResult(unittest.TestResult):
test (TestCase): The test just run
passed (bool): Whether the case is passed
"""
self.result[unicode(test.__class__.__name__)] = {
self.result[str(test.__class__.__name__)] = {
'started': self.started,
'stopped': time.strftime('%Y-%m-%dT%H:%M:%S'),
'passed': passed,
'error': error,
'executions': SimpleTestResult.executions
'executions': SimpleTestResult.executions,
}
if self.auto_reboot_args:
os.system('del "%s"' % RESUME_SCRIPT_PATH)
json.dump(OrderedDict(sorted(self.result.items(), key=lambda t: t[0])),
open(self.path, 'w'), indent=2)
json.dump(
OrderedDict(sorted(self.result.items(), key=lambda t: t[0])),
open(self.path, 'w'),
indent=2,
)
# save logs
logger.removeHandler(self.log_handler)
@@ -148,11 +175,16 @@ class SimpleTestResult(unittest.TestResult):
super(SimpleTestResult, self).addError(test, err)
self.add_result(test, None, str(err[1]))
def list_devices(names=None, continue_from=None, **kwargs):
"""List devices in settings file and print versions"""
if not names:
names = [device for device, _type in settings.GOLDEN_DEVICES if _type == 'OpenThread']
names = [
device
for device, _type in settings.GOLDEN_DEVICES
if _type == 'OpenThread'
]
if continue_from:
continue_from = names.index(continue_from)
@@ -163,13 +195,26 @@ def list_devices(names=None, continue_from=None, **kwargs):
try:
with OpenThreadController(port) as otc:
print('%s: %s' % (port, otc.version))
except:
except BaseException:
logger.exception('failed to get version of %s' % port)
def discover(names=None, pattern=['*.py'], skip='efp', dry_run=False, blacklist=None, name_greps=None,
manual_reset=False, delete_history=False, max_devices=0,
continue_from=None, result_file='./result.json', auto_reboot=False, keep_explorer=False,
add_all_devices=False):
def discover(
names=None,
pattern=['*.py'],
skip='efp',
dry_run=False,
blacklist=None,
name_greps=None,
manual_reset=False,
delete_history=False,
max_devices=0,
continue_from=None,
result_file='./result.json',
auto_reboot=False,
keep_explorer=False,
add_all_devices=False,
):
"""Discover all test cases and skip those passed
Args:
@@ -185,9 +230,12 @@ def discover(names=None, pattern=['*.py'], skip='efp', dry_run=False, blacklist=
if blacklist:
try:
excludes = [line.strip('\n') for line in open(blacklist, 'r').readlines()
if not line.startswith('#')]
except:
excludes = [
line.strip('\n')
for line in open(blacklist, 'r').readlines()
if not line.startswith('#')
]
except BaseException:
logger.exception('Failed to open test case black list file')
raise
else:
@@ -197,7 +245,7 @@ def discover(names=None, pattern=['*.py'], skip='efp', dry_run=False, blacklist=
if os.path.isfile(result_file):
try:
log = json.load(open(result_file, 'r'))
except:
except BaseException:
logger.exception('Failed to open result file')
if not log:
@@ -215,10 +263,13 @@ def discover(names=None, pattern=['*.py'], skip='efp', dry_run=False, blacklist=
for case in s2:
if case.__class__ is HarnessCase:
continue
case_name = unicode(case.__class__.__name__)
case_name = str(case.__class__.__name__)
# grep name
if name_greps and not any(fnmatch.fnmatch(case_name, name_grep) for name_grep in name_greps):
if name_greps and not any(
fnmatch.fnmatch(case_name, name_grep)
for name_grep in name_greps
):
logger.info('case[%s] skipped by name greps', case_name)
continue
@@ -229,16 +280,28 @@ def discover(names=None, pattern=['*.py'], skip='efp', dry_run=False, blacklist=
# skip cases
if case_name in log.keys():
if (log[case_name]['passed'] and ('p' in skip)) \
or (log[case_name]['passed'] is False and ('f' in skip)) \
or (log[case_name]['passed'] is None and ('e' in skip)):
logger.warning('case[%s] skipped for its status[%s]', case_name, log[case_name]['passed'])
if (
(log[case_name]['passed'] and ('p' in skip))
or (
log[case_name]['passed'] is False and ('f' in skip)
)
or (log[case_name]['passed'] is None and ('e' in skip))
):
logger.warning(
'case[%s] skipped for its status[%s]',
case_name,
log[case_name]['passed'],
)
continue
# continue from
if continue_from:
if continue_from != case_name:
logger.warning('case[%s] skipped for continue from[%s]', case_name, continue_from)
logger.warning(
'case[%s] skipped for continue from[%s]',
case_name,
continue_from,
)
continue
else:
continue_from = None
@@ -250,7 +313,11 @@ def discover(names=None, pattern=['*.py'], skip='efp', dry_run=False, blacklist=
# max devices
if max_devices and case.golden_devices_required > max_devices:
logger.warning('case[%s] skipped for exceeding max golden devices allowed[%d]', case_name, max_devices)
logger.warning(
'case[%s] skipped for exceeding max golden devices allowed[%d]',
case_name,
max_devices,
)
continue
suite.addTest(case)
@@ -281,7 +348,9 @@ def discover(names=None, pattern=['*.py'], skip='efp', dry_run=False, blacklist=
settings.PDU_CONTROLLER_OPEN_PARAMS = {}
settings.PDU_CONTROLLER_REBOOT_PARAMS = {}
result = SimpleTestResult(result_file, auto_reboot_args, keep_explorer, add_all_devices)
result = SimpleTestResult(
result_file, auto_reboot_args, keep_explorer, add_all_devices
)
for case in suite:
logger.info(case.__class__.__name__)
@@ -291,51 +360,145 @@ def discover(names=None, pattern=['*.py'], skip='efp', dry_run=False, blacklist=
suite.run(result)
return result
def main():
parser = argparse.ArgumentParser(description='Thread harness test case runner')
parser.add_argument('--auto-reboot', '-a', action='store_true', default=False,
help='restart system when harness service die')
parser.add_argument('names', metavar='NAME', type=str, nargs='*', default=None,
help='test case name, omit to test all')
parser.add_argument('--blacklist', '-b', metavar='BLACKLIST_FILE', type=str,
help='file to list test cases to skip', default=None)
parser.add_argument('--continue-from', '-c', type=str, default=None,
help='first case to test')
parser.add_argument('--delete-history', '-d', action='store_true', default=False,
help='clear history on startup')
parser.add_argument('--keep-explorer', '-e', action='store_true', default=False,
help='do not restart explorer.exe at the end')
parser.add_argument('--name-greps', '-g', action='append', default=None,
help='grep case by names')
parser.add_argument('--list-file', '-i', type=str, default=None,
help='file to list cases names to test')
parser.add_argument('--skip', '-k', metavar='SKIP', type=str,
help='type of results to skip.' \
'e for error, f for fail, p for pass.', default='')
parser.add_argument('--list-devices', '-l', action='store_true', default=False,
help='list devices')
parser.add_argument('--manual-reset', '-m', action='store_true', default=False,
help='reset devices manually')
parser.add_argument('--dry-run', '-n', action='store_true', default=False,
help='just show what to run')
parser.add_argument('--result-file', '-o', type=str, default=settings.OUTPUT_PATH + '\\result.json',
help='file to store and read current status')
parser.add_argument('--pattern', '-p', metavar='PATTERN', type=str,
help='file name pattern, default to "*.py"', default='*.py')
parser.add_argument('--rerun-fails', '-r', type=int, default=0,
help='number of times to rerun failed test cases')
parser.add_argument('--add-all-devices', '-t', action='store_true', default=False,
help='add all devices to the test bed')
parser.add_argument('--max-devices', '-u', type=int, default=0,
help='max golden devices allowed')
parser = argparse.ArgumentParser(
description='Thread harness test case runner'
)
parser.add_argument(
'--auto-reboot',
'-a',
action='store_true',
default=False,
help='restart system when harness service die',
)
parser.add_argument(
'names',
metavar='NAME',
type=str,
nargs='*',
default=None,
help='test case name, omit to test all',
)
parser.add_argument(
'--blacklist',
'-b',
metavar='BLACKLIST_FILE',
type=str,
help='file to list test cases to skip',
default=None,
)
parser.add_argument(
'--continue-from',
'-c',
type=str,
default=None,
help='first case to test',
)
parser.add_argument(
'--delete-history',
'-d',
action='store_true',
default=False,
help='clear history on startup',
)
parser.add_argument(
'--keep-explorer',
'-e',
action='store_true',
default=False,
help='do not restart explorer.exe at the end',
)
parser.add_argument(
'--name-greps',
'-g',
action='append',
default=None,
help='grep case by names',
)
parser.add_argument(
'--list-file',
'-i',
type=str,
default=None,
help='file to list cases names to test',
)
parser.add_argument(
'--skip',
'-k',
metavar='SKIP',
type=str,
help='type of results to skip.' 'e for error, f for fail, p for pass.',
default='',
)
parser.add_argument(
'--list-devices',
'-l',
action='store_true',
default=False,
help='list devices',
)
parser.add_argument(
'--manual-reset',
'-m',
action='store_true',
default=False,
help='reset devices manually',
)
parser.add_argument(
'--dry-run',
'-n',
action='store_true',
default=False,
help='just show what to run',
)
parser.add_argument(
'--result-file',
'-o',
type=str,
default=settings.OUTPUT_PATH + '\\result.json',
help='file to store and read current status',
)
parser.add_argument(
'--pattern',
'-p',
metavar='PATTERN',
type=str,
help='file name pattern, default to "*.py"',
default='*.py',
)
parser.add_argument(
'--rerun-fails',
'-r',
type=int,
default=0,
help='number of times to rerun failed test cases',
)
parser.add_argument(
'--add-all-devices',
'-t',
action='store_true',
default=False,
help='add all devices to the test bed',
)
parser.add_argument(
'--max-devices',
'-u',
type=int,
default=0,
help='max golden devices allowed',
)
args = vars(parser.parse_args())
if args['list_file']:
try:
names = [line.strip('\n') for line in open(args['list_file'], 'r').readlines()
if not line.startswith('#')]
except:
names = [
line.strip('\n')
for line in open(args['list_file'], 'r').readlines()
if not line.startswith('#')
]
except BaseException:
logger.exception('Failed to open test case list file')
raise
else:
@@ -352,15 +515,25 @@ def main():
if rerun_fails > 0:
for i in range(rerun_fails):
failed_names = {name for name in result.result if result.result[name]['passed'] == False}
if not failed_names: break
failed_names = {
name
for name in result.result
if result.result[name]['passed'] is False
}
if not failed_names:
break
logger.info('Rerunning failed test cases')
logger.info('Rerun #{}:'.format(i+1))
logger.info('Rerun #{}:'.format(i + 1))
result = discover(
names=failed_names, pattern=args['pattern'], skip='', result_file=args['result_file'],
auto_reboot=args['auto_reboot'], keep_explorer=args['keep_explorer'],
add_all_devices=args['add_all_devices']
names=failed_names,
pattern=args['pattern'],
skip='',
result_file=args['result_file'],
auto_reboot=args['auto_reboot'],
keep_explorer=args['keep_explorer'],
add_all_devices=args['add_all_devices'],
)
if __name__ == '__main__':
main()
@@ -60,7 +60,7 @@ THREAD_SED_POLLING_INTERVAL = 0
"""int: SED polling interval in seconds. Set to 0 to use Harness's default value."""
HARNESS_HOME = 'C:\\GRL\\Thread1.1'
"""str: Harness installation path, e.g. ``C:\GRL\Thread1.1``"""
r"""str: Harness installation path, e.g. ``C:\GRL\Thread1.1``"""
HARNESS_URL = 'http://127.0.0.1:8000'
"""str: Harness front-end url"""
@@ -81,7 +81,10 @@ For OpenThread golden devices, ser2net is also supported, just use IP:PORT for t
"""
MIXED_DEVICE_TYPE = True
"""bool: Whether golden devices are mixed-type. Must put TopologyConfig.txt under HARNESS_HOME\Thread_Harness\TestScripts before testing if True"""
r"""bool: Whether golden devices are mixed-type. Must put
TopologyConfig.txt under
HARNESS_HOME\Thread_Harness\TestScripts before testing if True
"""
OUTPUT_PATH = '.\\output'
"""str: Path to store results and logs, MUST be writable."""
@@ -26,5 +26,3 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_8_1_1(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '8 1 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_8_1_2(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '8 1 2'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_8_1_6(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '8 1 6'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_8_2_1(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '8 2 1'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_8_2_2(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '8 2 2'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_8_2_5(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '8 2 5'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_8_3_1(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '8 3 1'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_9_2_1(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '9 2 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_9_2_14(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '9 2 14'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_9_2_19(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '9 2 19'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_9_2_2(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '9 2 2'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_9_2_3(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '9 2 3'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_9_2_4(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '9 2 4'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_1_1(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 1 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_1_2(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 1 2'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_1_3(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 1 3'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_1_4(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 1 4'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_1_5(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 1 5'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_1_6(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 1 6'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_2_1(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 2 1'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_2_2(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 2 2'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_3_1(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 3 1'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_4_1(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 4 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_4_2(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 4 2'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -33,10 +33,12 @@ import time
from autothreadharness.harness_case import HarnessCase
class ED_6_5_1(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 5 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
if title.startswith('Reset DUT'):
self.dut.stop()
@@ -44,5 +46,6 @@ class ED_6_5_1(HarnessCase):
self.dut.start()
return False
if __name__ == '__main__':
unittest.main()
+3 -3
View File
@@ -28,16 +28,16 @@
#
import time
import unittest
import re
from autothreadharness.harness_case import HarnessCase
class ED_6_5_2(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 5 2'
golden_devices_required = 2
def on_dialog(self, dialog, title):
if title.startswith('Reset DUT'):
self.dut.stop()
@@ -46,7 +46,7 @@ class ED_6_5_2(HarnessCase):
elif title.startswith('Rejoin Now'):
self.dut.start()
return False
if __name__ == '__main__':
unittest.main()
+3 -1
View File
@@ -28,15 +28,16 @@
#
import time
import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_5_3(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 5 3'
golden_devices_required = 1
def on_dialog(self, dialog, title):
if title.startswith('Reset DUT'):
self.dut.stop()
@@ -46,5 +47,6 @@ class ED_6_5_3(HarnessCase):
self.dut.start()
return False
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_6_1(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 6 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_6_2(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 6 2'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_9_2_17(HarnessCase):
role = HarnessCase.ROLE_ED
case = '9 2 17'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class ED_9_2_8(HarnessCase):
role = HarnessCase.ROLE_ED
case = '9 2 8'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class FED_5_7_1(HarnessCase):
role = HarnessCase.ROLE_FED
case = '5 7 1'
golden_devices_required = 5
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class FED_5_7_3(HarnessCase):
role = HarnessCase.ROLE_FED
case = '5 7 3'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class FED_6_1_7(HarnessCase):
role = HarnessCase.ROLE_FED
case = '6 1 7'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class FED_9_2_13(HarnessCase):
role = HarnessCase.ROLE_FED
case = '9 2 13'
golden_devices_required = 5
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Joiner_8_1_1(HarnessCase):
role = HarnessCase.ROLE_JOINER
case = '8 1 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Joiner_8_1_6(HarnessCase):
role = HarnessCase.ROLE_JOINER
case = '8 1 6'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_1_1(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 1 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -29,20 +29,24 @@
from autothreadharness.harness_case import HarnessCase
import time
import unittest
class Leader_5_1_13(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 1 13'
golden_devices_required = 1
def on_dialog(self, dialog, title):
if title.startswith('User Input Required'):
#body = dialog.find_element_by_id('cnfrmMsg').text
#if body.startswith('Reset Leader'):
# body = dialog.find_element_by_id('cnfrmMsg').text
# if body.startswith('Reset Leader'):
self.dut.stop()
time.sleep(1)
self.dut.start()
return False
if __name__ == '__main__':
unittest.main()
@@ -31,12 +31,15 @@
from autothreadharness.harness_case import HarnessCase
import unittest
class Leader_5_1_5(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 1 5'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_2_3(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 2 3'
golden_devices_required = 32
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -31,12 +31,15 @@
from autothreadharness.harness_case import HarnessCase
import unittest
class Leader_5_3_6(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 3 6'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_3_7(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 3 7'
golden_devices_required = 5
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_3_8(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 3 8'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -34,10 +34,12 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_5_1(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 5 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
if title.startswith('User Input Required'):
body = dialog.find_element_by_id('cnfrmMsg').text
@@ -51,5 +53,6 @@ class Leader_5_5_1(HarnessCase):
self.dut.start()
return False
if __name__ == '__main__':
unittest.main()
@@ -33,10 +33,12 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_5_2(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 5 2'
golden_devices_required = 2
def on_dialog(self, dialog, title):
if title.startswith('User Input Required'):
self.dut.stop()
@@ -44,5 +46,6 @@ class Leader_5_5_2(HarnessCase):
self.dut.start()
return False
if __name__ == '__main__':
unittest.main()
@@ -28,15 +28,16 @@
#
import time
import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_5_3(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 5 3'
golden_devices_required = 5
def on_dialog(self, dialog, title):
if title.startswith('Reset DUT'):
self.dut.stop()
@@ -46,5 +47,6 @@ class Leader_5_5_3(HarnessCase):
self.dut.start()
return False
if __name__ == '__main__':
unittest.main()
@@ -28,15 +28,16 @@
#
import time
import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_5_4(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 5 4'
golden_devices_required = 5
def on_dialog(self, dialog, title):
if title.startswith('Reset DUT'):
self.dut.stop()
@@ -46,5 +47,6 @@ class Leader_5_5_4(HarnessCase):
self.dut.start()
return False
if __name__ == '__main__':
unittest.main()
@@ -30,13 +30,14 @@
from autothreadharness.harness_case import HarnessCase
import time
import unittest
class Leader_5_5_7(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 5 7'
golden_devices_required = 3
def on_dialog(self, dialog, title):
if title.startswith('Reset DUT'):
self.dut.stop()
@@ -46,5 +47,6 @@ class Leader_5_5_7(HarnessCase):
self.dut.start()
return False
if __name__ == '__main__':
unittest.main()
@@ -31,12 +31,15 @@
from autothreadharness.harness_case import HarnessCase
import unittest
class Leader_5_6_2(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 6 2'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_6_4(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 6 4'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_6_5(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 6 5'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_6_6(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 6 6'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_5_8_4(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '5 8 4'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -31,12 +31,15 @@
from autothreadharness.harness_case import HarnessCase
import unittest
class Leader_7_1_1(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '7 1 1'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -31,12 +31,15 @@
from autothreadharness.harness_case import HarnessCase
import unittest
class Leader_7_1_3(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '7 1 3'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -31,12 +31,15 @@
from autothreadharness.harness_case import HarnessCase
import unittest
class Leader_7_1_6(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '7 1 6'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -31,12 +31,15 @@
from autothreadharness.harness_case import HarnessCase
import unittest
class Leader_7_1_7(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '7 1 7'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_8_3_1(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '8 3 1'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_1(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_11(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 11'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_12(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 12'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_18(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 18'
golden_devices_required = 5
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_19(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 19'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_2(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 2'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_3(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 3'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_4(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 4'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_5(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 5'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_6(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 6'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_7(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 7'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Leader_9_2_9(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '9 2 9'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class MED_6_3_2(HarnessCase):
role = HarnessCase.ROLE_MED
case = '6 3 2'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class MED_9_2_10(HarnessCase):
role = HarnessCase.ROLE_MED
case = '9 2 10'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class MED_9_2_12(HarnessCase):
role = HarnessCase.ROLE_MED
case = '9 2 12'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class MED_9_2_13(HarnessCase):
role = HarnessCase.ROLE_MED
case = '9 2 13'
golden_devices_required = 5
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class MED_9_2_18(HarnessCase):
role = HarnessCase.ROLE_MED
case = '9 2 18'
golden_devices_required = 5
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class MED_9_2_6(HarnessCase):
role = HarnessCase.ROLE_MED
case = '9 2 6'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class REED_5_2_4(HarnessCase):
role = HarnessCase.ROLE_REED
case = '5 2 4'
golden_devices_required = 17
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class REED_5_2_5(HarnessCase):
role = HarnessCase.ROLE_REED
case = '5 2 5'
golden_devices_required = 17
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class REED_5_2_7(HarnessCase):
role = HarnessCase.ROLE_REED
case = '5 2 7'
golden_devices_required = 16
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class REED_5_5_5(HarnessCase):
role = HarnessCase.ROLE_REED
case = '5 5 5'
golden_devices_required = 16
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class REED_5_6_7(HarnessCase):
role = HarnessCase.ROLE_REED
case = '5 6 7'
golden_devices_required = 16
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class REED_5_7_2(HarnessCase):
role = HarnessCase.ROLE_REED
case = '5 7 2'
golden_devices_required = 16
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Router_5_1_1(HarnessCase):
role = HarnessCase.ROLE_ROUTER
case = '5 1 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,10 +32,12 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Router_5_1_10(HarnessCase):
role = HarnessCase.ROLE_ROUTER
case = '5 1 10'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Router_5_1_11(HarnessCase):
role = HarnessCase.ROLE_ROUTER
case = '5 1 11'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Router_5_1_12(HarnessCase):
role = HarnessCase.ROLE_ROUTER
case = '5 1 12'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -29,14 +29,15 @@
import unittest
import time
from autothreadharness.harness_case import HarnessCase
class Router_5_1_13(HarnessCase):
role = HarnessCase.ROLE_ROUTER
case = '5 1 13'
golden_devices_required = 1
def on_dialog(self, dialog, title):
if title.startswith('Reset DUT'):
self.dut.stop()
@@ -46,5 +47,6 @@ class Router_5_1_13(HarnessCase):
self.dut.start()
return False
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Router_5_1_2(HarnessCase):
role = HarnessCase.ROLE_ROUTER
case = '5 1 2'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
@@ -32,12 +32,15 @@ import unittest
from autothreadharness.harness_case import HarnessCase
class Router_5_1_3(HarnessCase):
role = HarnessCase.ROLE_ROUTER
case = '5 1 3'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()

Some files were not shown because too many files have changed in this diff Show More