mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-04 12:48:00 +00:00
added pass/fail method in lfcli and edited example_x functions
This commit is contained in:
@@ -365,6 +365,10 @@ class LFCliBase:
|
|||||||
if (fail_counter == 0) and (pass_counter > 0):
|
if (fail_counter == 0) and (pass_counter > 0):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
#use this function to
|
||||||
|
def failed(self):
|
||||||
|
print("Test failed. Exiting now.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# use this inside the class to log a failure result
|
# use this inside the class to log a failure result
|
||||||
def _fail(self, message, print_=False):
|
def _fail(self, message, print_=False):
|
||||||
@@ -374,6 +378,11 @@ class LFCliBase:
|
|||||||
if self.exit_on_fail:
|
if self.exit_on_fail:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
def passed(self):
|
||||||
|
print("Test passed conclusively.")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
# use this inside the class to log a pass result
|
# use this inside the class to log a pass result
|
||||||
def _pass(self, message, print_=False):
|
def _pass(self, message, print_=False):
|
||||||
self.test_results.append(self.pass_pref + message)
|
self.test_results.append(self.pass_pref + message)
|
||||||
|
|||||||
@@ -52,11 +52,12 @@ class IPv4Test(LFCliBase):
|
|||||||
self.station_profile.create(radio="wiphy0", sta_names_=self.sta_list, debug=self.debug)
|
self.station_profile.create(radio="wiphy0", sta_names_=self.sta_list, debug=self.debug)
|
||||||
self.station_profile.admin_up()
|
self.station_profile.admin_up()
|
||||||
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
||||||
self._pass("Station build finished", print_=True)
|
self._pass("Station build finished")
|
||||||
exit(0)
|
self.passed()
|
||||||
else:
|
else:
|
||||||
self._fail("Stations not able to acquire IP. Please check network input.", print_=True)
|
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||||
exit(1)
|
print(self.get_failed_result_list())
|
||||||
|
self.failed()
|
||||||
|
|
||||||
|
|
||||||
def cleanup(self, sta_list):
|
def cleanup(self, sta_list):
|
||||||
|
|||||||
@@ -53,11 +53,12 @@ class IPv4Test(LFCliBase):
|
|||||||
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
||||||
self.station_profile.admin_up()
|
self.station_profile.admin_up()
|
||||||
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
||||||
self._pass("Station build finished", print_=True)
|
self._pass("Station build finished")
|
||||||
exit(0)
|
self.passed()
|
||||||
else:
|
else:
|
||||||
self._fail("Stations not able to acquire IP. Please check network input.", print_=True)
|
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||||
exit(1)
|
print(self.get_failed_result_list())
|
||||||
|
self.failed()
|
||||||
|
|
||||||
def cleanup(self, sta_list):
|
def cleanup(self, sta_list):
|
||||||
self.station_profile.cleanup(sta_list)
|
self.station_profile.cleanup(sta_list)
|
||||||
|
|||||||
@@ -53,11 +53,14 @@ class IPv4Test(LFCliBase):
|
|||||||
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
||||||
self.station_profile.admin_up()
|
self.station_profile.admin_up()
|
||||||
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
||||||
self._pass("Station build finished", print_=True)
|
self._pass("Station build finished")
|
||||||
exit(0)
|
self.passed()
|
||||||
else:
|
else:
|
||||||
self._fail("Stations not able to acquire IP. Please check network input.", print_=True)
|
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||||
exit(1)
|
self
|
||||||
|
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||||
|
print(self.get_failed_result_list())
|
||||||
|
self.failed()
|
||||||
|
|
||||||
def cleanup(self, sta_list):
|
def cleanup(self, sta_list):
|
||||||
self.station_profile.cleanup(sta_list)
|
self.station_profile.cleanup(sta_list)
|
||||||
|
|||||||
@@ -53,11 +53,12 @@ class IPv4Test(LFCliBase):
|
|||||||
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
||||||
self.station_profile.admin_up()
|
self.station_profile.admin_up()
|
||||||
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
||||||
self._pass("Station build finished", print_=True)
|
self._pass("Station build finished")
|
||||||
exit(0)
|
self.passed()
|
||||||
else:
|
else:
|
||||||
self._fail("Stations not able to acquire IP. Please check network input.", print_=True)
|
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||||
exit(1)
|
print(self.get_failed_result_list())
|
||||||
|
self.failed()
|
||||||
|
|
||||||
|
|
||||||
def cleanup(self, sta_list):
|
def cleanup(self, sta_list):
|
||||||
|
|||||||
@@ -53,11 +53,14 @@ class IPv4Test(LFCliBase):
|
|||||||
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
||||||
self.station_profile.admin_up()
|
self.station_profile.admin_up()
|
||||||
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
||||||
self._pass("Station build finished", print_=True)
|
self._pass("Station build finished")
|
||||||
exit(0)
|
self.passed()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self._fail("Stations not able to acquire IP. Please check network input.", print_=True)
|
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||||
exit(1)
|
print(self.get_failed_result_list())
|
||||||
|
self.failed()
|
||||||
|
|
||||||
|
|
||||||
def cleanup(self, sta_list):
|
def cleanup(self, sta_list):
|
||||||
self.station_profile.cleanup(sta_list)
|
self.station_profile.cleanup(sta_list)
|
||||||
|
|||||||
Reference in New Issue
Block a user