Example start and build method:def build(self):
self.station_profile.use_security(self.security, self.ssid, self.password)
self.station_profile.set_number_template(self.number_template)
print("Creating stations")
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1)
self.station_profile.set_command_param("set_port", "report_timer", 1500)
self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
self.cx_profile.create(ports=self.station_profile.station_names, sleep_time=.5)
self._pass("PASS: Station build finished")
def start(self, print_pass=False, print_fail=False):
self.station_profile.admin_up()
temp_stas = self.sta_list.copy()
temp_stas.append(self.upstream)
if self.local_realm.wait_for_ip(temp_stas):
self._pass("All stations got IPs", print_pass)
else:
self._fail("Stations failed to get IPs", print_fail)
exit(1)
cur_time = datetime.datetime.now()
passes = 0
expected_passes = 0
self.cx_profile.start_cx()
time.sleep(15)
end_time = self.local_realm.parse_time("30s") + cur_time
print("Starting Test...")
while cur_time < end_time:
cur_time = datetime.datetime.now()
gen_results = self.json_get("generic/list?fields=name,last+results", debug_=self.debug)
if gen_results['endpoints'] is not None:
for name in gen_results['endpoints']:
for k, v in name.items():
if v['name'] in self.cx_profile.created_endp and not v['name'].endswith('1'):
expected_passes += 1
if v['last results'] != "" and "Unreachable" not in v['last results']:
passes += 1
else:
self._fail("%s Failed to ping %s " % (v['name'], self.cx_profile.dest), print_fail)
break
time.sleep(1)
if passes == expected_passes:
self._pass("PASS: All tests passed", print_pass)