mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
added self.debug if statements for less output, 1k just about finished - just thorough testing left
This commit is contained in:
@@ -555,6 +555,7 @@ class Realm(LFCliBase):
|
||||
return not wait_more
|
||||
|
||||
def get_curr_num_ips(self,num_sta_with_ips=0,station_list=None, ipv4=True, ipv6=False, debug=False):
|
||||
if debug:
|
||||
print("checking number of stations with ips...")
|
||||
waiting_states = ["0.0.0.0", "NA", ""]
|
||||
if (station_list is None) or (len(station_list) < 1):
|
||||
@@ -621,8 +622,6 @@ class Realm(LFCliBase):
|
||||
raise ValueError("time_string must be of type str. Type %s provided" % type(time_string))
|
||||
return duration_sec
|
||||
|
||||
pass
|
||||
|
||||
def parse_time(self, time_string):
|
||||
if isinstance(time_string, str):
|
||||
pattern = re.compile("^(\d+)([dhms]$)")
|
||||
@@ -1014,6 +1013,7 @@ class L3CXProfile(LFCliBase):
|
||||
def start_cx(self):
|
||||
print("Starting CXs...")
|
||||
for cx_name in self.created_cx.keys():
|
||||
if self.debug:
|
||||
print("cx-name: %s"%(cx_name))
|
||||
self.json_post("/cli-json/set_cx_state", {
|
||||
"test_mgr": "default_tm",
|
||||
@@ -1037,11 +1037,13 @@ class L3CXProfile(LFCliBase):
|
||||
print("Cleaning up cxs and endpoints")
|
||||
if len(self.created_cx) != 0:
|
||||
for cx_name in self.created_cx.keys():
|
||||
if self.debug:
|
||||
print("Cleaning cx: %s"%(cx_name))
|
||||
self.local_realm.rm_cx(cx_name)
|
||||
|
||||
for side in range(len(self.created_cx[cx_name])):
|
||||
ename = self.created_cx[cx_name][side]
|
||||
if self.debug:
|
||||
print("Cleaning endpoint: %s"%(ename))
|
||||
self.local_realm.rm_endp(self.created_cx[cx_name][side])
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ class Test1KClients(LFCliBase):
|
||||
self.cx_profile.side_b_min_bps = side_b_min_rate
|
||||
self.cx_profile.side_b_max_bps = side_b_max_rate
|
||||
|
||||
|
||||
self.station_profile_map = {}
|
||||
def build(self):
|
||||
for (radio, name_series) in self.station_radio_map.items():
|
||||
@@ -117,7 +118,6 @@ class Test1KClients(LFCliBase):
|
||||
expected_passes += 1
|
||||
if new_list[item] > old_list[item]:
|
||||
passes += 1
|
||||
# print(item, new_list[item], old_list[item], passes, expected_passes)
|
||||
|
||||
if passes == expected_passes:
|
||||
return True
|
||||
@@ -129,9 +129,9 @@ class Test1KClients(LFCliBase):
|
||||
def start(self):
|
||||
print("Bringing stations up...")
|
||||
prev_ip_num=0
|
||||
total_num_sta=6*self.num_sta
|
||||
for (radio, station_profile) in self.station_profile_map.items():
|
||||
station_profile.admin_up()
|
||||
total_num_sta=6*self.num_sta
|
||||
self.local_realm.wait_for_ip(station_list=self.station_radio_map[radio], debug=self.debug, timeout_sec=30)
|
||||
curr_ip_num = self.local_realm.get_curr_num_ips(num_sta_with_ips=prev_ip_num,station_list=self.station_radio_map[radio], debug=self.debug)
|
||||
while ((prev_ip_num < curr_ip_num) and (curr_ip_num < total_num_sta)):
|
||||
@@ -146,25 +146,23 @@ class Test1KClients(LFCliBase):
|
||||
|
||||
|
||||
old_cx_rx_values = self.__get_rx_values()
|
||||
print("Test duration is %s", self.test_duration)
|
||||
#for loop through all and start all cross-connects
|
||||
for (radio, station_profile) in self.station_profile_map.items():
|
||||
self.cx_profile.start_cx()
|
||||
|
||||
passes = 0
|
||||
expected_passes = 0
|
||||
cur_time = datetime.datetime.now()
|
||||
end_time = self.local_realm.parse_time(self.test_duration) + cur_time
|
||||
curr_time = datetime.datetime.now()
|
||||
end_time = self.local_realm.parse_time(self.test_duration) + curr_time
|
||||
sleep_interval = self.local_realm.parse_time(self.test_duration) // 3
|
||||
|
||||
while cur_time < end_time:
|
||||
while curr_time < end_time:
|
||||
|
||||
time.sleep(sleep_interval.total_seconds())
|
||||
|
||||
new_cx_rx_values = self.__get_rx_values()
|
||||
if self.debug:
|
||||
print(old_cx_rx_values, new_cx_rx_values)
|
||||
print("\n-----------------------------------")
|
||||
print(cur_time, end_time, cur_time + datetime.timedelta(minutes=1))
|
||||
print(curr_time, end_time)
|
||||
print("-----------------------------------\n")
|
||||
expected_passes += 1
|
||||
if self.__compare_vals(old_cx_rx_values, new_cx_rx_values):
|
||||
@@ -174,23 +172,30 @@ class Test1KClients(LFCliBase):
|
||||
self.exit_fail()
|
||||
|
||||
old_cx_rx_values = new_cx_rx_values
|
||||
cur_time = datetime.datetime.now()
|
||||
curr_time = datetime.datetime.now()
|
||||
|
||||
if passes == expected_passes:
|
||||
self._pass("PASS: All tests passed")
|
||||
|
||||
|
||||
def stop(self):
|
||||
for (radio, station_profile) in self.station_profile_map.items():
|
||||
self.cx_profile.stop_cx()
|
||||
|
||||
def cleanup(self):
|
||||
#self.cx_profile.cleanup_prefix()
|
||||
def pre_cleanup(self):
|
||||
self.cx_profile.cleanup_prefix()
|
||||
for (radio, name_series) in self.station_radio_map.items():
|
||||
sta_list= self.station_radio_map[radio]
|
||||
for sta in sta_list:
|
||||
self.local_realm.rm_port(sta, check_exists=True)
|
||||
|
||||
def post_cleanup(self):
|
||||
self.cx_profile.cleanup()
|
||||
for (radio, name_series) in self.station_radio_map.items():
|
||||
sta_list= self.station_radio_map[radio]
|
||||
for sta in sta_list:
|
||||
self.local_realm.rm_port(sta, check_exists=True)
|
||||
|
||||
|
||||
def main():
|
||||
num_sta=200
|
||||
lfjson_host = "localhost"
|
||||
@@ -227,7 +232,7 @@ def main():
|
||||
num_sta_=args.sta_per_radio,
|
||||
_debug_on=args.debug)
|
||||
|
||||
kilo_test.cleanup()
|
||||
kilo_test.pre_cleanup()
|
||||
kilo_test.build()
|
||||
if not kilo_test.passes():
|
||||
kilo_test.exit_failed()
|
||||
@@ -237,7 +242,9 @@ def main():
|
||||
kilo_test.stop()
|
||||
if not kilo_test.passes():
|
||||
kilo_test.exit_failed()
|
||||
kilo_test.cleanup()
|
||||
time.sleep(60)
|
||||
kilo_test.post_cleanup()
|
||||
kilo_test.exit_success()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user