Added files lf_hard_roam_test, lf_logger_config

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
jitendracandela
2022-06-03 12:29:56 +05:30
committed by shivam
parent 1ab5118164
commit c87ef2564c

View File

@@ -22,7 +22,6 @@ if sys.version_info[0] != 3:
logger.critical("This script requires Python 3") logger.critical("This script requires Python 3")
exit(1) exit(1)
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../"))) sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
lfcli_base = importlib.import_module("py-json.LANforge.lfcli_base") lfcli_base = importlib.import_module("py-json.LANforge.lfcli_base")
LFCliBase = lfcli_base.LFCliBase LFCliBase = lfcli_base.LFCliBase
@@ -476,7 +475,8 @@ class HardRoam(Realm):
for i in range(self.num_sta): for i in range(self.num_sta):
file = 'test_client_' + str(i) + '.csv' file = 'test_client_' + str(i) + '.csv'
lf_csv_obj = lf_csv.lf_csv(_columns=['Iterations', 'bssid1', 'bssid2', "Roam Time(ms)", lf_csv_obj = lf_csv.lf_csv(_columns=['Iterations', 'bssid1', 'bssid2', "Roam Time(ms)",
"PASS/FAIL", "Pcap file Name", "Log File", "Remark"], _rows=[], _filename=file) "PASS/FAIL", "Pcap file Name", "Log File", "Remark"], _rows=[],
_filename=file)
# "Packet loss", # "Packet loss",
file_name.append(file) file_name.append(file)
lf_csv_obj.generate_csv() lf_csv_obj.generate_csv()
@@ -491,7 +491,8 @@ class HardRoam(Realm):
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
command = "journalctl --since '5 minutes ago' > kernel_log" + file + ".txt" command = "journalctl --since '5 minutes ago' > kernel_log" + file + ".txt"
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname=self.lanforge_ip, port=self.lanforge_ssh_port, username="lanforge", password="lanforge", banner_timeout=600) ssh.connect(hostname=self.lanforge_ip, port=self.lanforge_ssh_port, username="lanforge",
password="lanforge", banner_timeout=600)
stdin, stdout, stderr = ssh.exec_command(str(command)) stdin, stdout, stderr = ssh.exec_command(str(command))
stdout.readlines() stdout.readlines()
ssh.close() ssh.close()
@@ -503,7 +504,8 @@ class HardRoam(Realm):
return jor_lst return jor_lst
# gives wlan management status of pcap file # gives wlan management status of pcap file
def get_wlan_mgt_status(self, file_name, filter="(wlan.fc.type_subtype eq 3 && wlan.fixed.status_code == 0x0000 && wlan.tag.number == 55)"): def get_wlan_mgt_status(self, file_name,
filter="(wlan.fc.type_subtype eq 3 && wlan.fixed.status_code == 0x0000 && wlan.tag.number == 55)"):
query_reasso_response = self.pcap_obj.get_wlan_mgt_status_code(pcap_file=str(file_name), query_reasso_response = self.pcap_obj.get_wlan_mgt_status_code(pcap_file=str(file_name),
filter=filter) filter=filter)
print("query", query_reasso_response) print("query", query_reasso_response)
@@ -548,8 +550,6 @@ class HardRoam(Realm):
self.attenuator_modify(ser_1, "all", 0) self.attenuator_modify(ser_1, "all", 0)
self.attenuator_modify(ser_2, "all", 0) self.attenuator_modify(ser_2, "all", 0)
# create clients with respect to bands # create clients with respect to bands
self.start_sniffer(radio_channel=int(self.channel), radio=self.sniff_radio, self.start_sniffer(radio_channel=int(self.channel), radio=self.sniff_radio,
test_name="roam_11r_" + str(self.option) + "start" + "_", test_name="roam_11r_" + str(self.option) + "start" + "_",
@@ -604,8 +604,6 @@ class HardRoam(Realm):
# # time.sleep(40) # # time.sleep(40)
# exit() # exit()
# if all stations got ip check mac address # if all stations got ip check mac address
if val: if val:
print("all stations got ip") print("all stations got ip")
@@ -823,7 +821,6 @@ class HardRoam(Realm):
print("station are connected to post bssid", post_bssid) print("station are connected to post bssid", post_bssid)
result1 = all(element == before_bssid[0] for element in before_bssid) result1 = all(element == before_bssid[0] for element in before_bssid)
if result1: if result1:
print("All stations connected to one ap") print("All stations connected to one ap")
for i in before_bssid: for i in before_bssid:
@@ -1112,12 +1109,14 @@ class HardRoam(Realm):
if roam_time < 50: if roam_time < 50:
pass_fail_list.append("FAIL") pass_fail_list.append("FAIL")
pcap_file_list.append(str(file_name)) pcap_file_list.append(str(file_name))
remark.append("(bssid mismatched)Client disconnected after roaming") remark.append(
"(bssid mismatched)Client disconnected after roaming")
else: else:
pass_fail_list.append("FAIL") pass_fail_list.append("FAIL")
pcap_file_list.append(str(file_name)) pcap_file_list.append(str(file_name))
remark.append("(bssid mis matched)Roam time is greater then 50 ms,") remark.append(
"(bssid mis matched)Roam time is greater then 50 ms,")
else: else:
@@ -1280,10 +1279,10 @@ class HardRoam(Realm):
dataset.append(fail_list) dataset.append(fail_list)
print(dataset) print(dataset)
# it will contain per station station pass and fail number eg [[9, 7], [3, 4]] here 9, 7 are pass number for clients 3 and 4 are fail number # it will contain per station station pass and fail number eg [[9, 7], [3, 4]] here 9, 7 are pass number for clients 3 and 4 are fail number
# dataset = [[9, 7 , 4], [3, 4,9]] # dataset = [[9, 7 , 4], [3, 4,9]]
graph = lf_graph.lf_bar_graph(_data_set=dataset, _xaxis_name="Stations = " + str(self.num_sta), _yaxis_name="Total iterations = " + str(self.iteration), graph = lf_graph.lf_bar_graph(_data_set=dataset, _xaxis_name="Stations = " + str(self.num_sta),
_yaxis_name="Total iterations = " + str(self.iteration),
_xaxis_categories=x_axis_category, _xaxis_categories=x_axis_category,
_label=["Pass", "Fail"], _xticks_font=8, _label=["Pass", "Fail"], _xticks_font=8,
_graph_image_name="11r roam client per iteration graph", _graph_image_name="11r roam client per iteration graph",
@@ -1351,7 +1350,8 @@ class HardRoam(Realm):
# report.set_table_title("Client information " + str(i)) # report.set_table_title("Client information " + str(i))
# report.build_table_title() # report.build_table_title()
report.set_obj_html("Client " + str(i + 1) + " Information", "This Table gives detailed information " report.set_obj_html("Client " + str(i + 1) + " Information", "This Table gives detailed information "
"of client " + str(i+1) + " like the bssid it was before roam," + "of client " + str(
i + 1) + " like the bssid it was before roam," +
" bssid it was after roam, " + " bssid it was after roam, " +
"roam time, capture file name and ra_trace file name along with remarks ") "roam time, capture file name and ra_trace file name along with remarks ")
@@ -1449,7 +1449,6 @@ def main():
report_dir_name = obj.generate_report(csv_list=file, kernel_lst=kernel, current_path=str(x) + "/tests") report_dir_name = obj.generate_report(csv_list=file, kernel_lst=kernel, current_path=str(x) + "/tests")
print(report_dir_name) print(report_dir_name)
# file = obj.generate_csv() # file = obj.generate_csv()
# obj.run(file_n=file) # obj.run(file_n=file)
# obj.generate_report(csv_list=file) # obj.generate_report(csv_list=file)