mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 11:18:03 +00:00
lf_report.py: added get date, test_l3_longevity: added ability to clear and read ap/stats
lf_report.py the get_date will allow for timestamps to be added to addtional files to be stored in results test_l3_longevity.py Phase 2, add the abilty to clear and read the ap upload and download stats write the output to a file in the results. The clear takes place at the beginning of the test and reading at the end It was unclear if the ap needed to be read on each interation
This commit is contained in:
@@ -175,6 +175,7 @@ class lf_report():
|
|||||||
def set_graph_title(self,_graph_title):
|
def set_graph_title(self,_graph_title):
|
||||||
self.graph_title = _graph_title
|
self.graph_title = _graph_title
|
||||||
|
|
||||||
|
# The _date is set when class is enstanciated / created so this set_date should be used with caution, used to synchronize results
|
||||||
def set_date(self,_date):
|
def set_date(self,_date):
|
||||||
self.date = _date
|
self.date = _date
|
||||||
|
|
||||||
@@ -194,9 +195,12 @@ class lf_report():
|
|||||||
def set_graph_image(self,_graph_image):
|
def set_graph_image(self,_graph_image):
|
||||||
self.graph_image = _graph_image
|
self.graph_image = _graph_image
|
||||||
|
|
||||||
|
def get_date(self):
|
||||||
|
return self.date
|
||||||
|
|
||||||
def get_path(self):
|
def get_path(self):
|
||||||
return self.path
|
return self.path
|
||||||
# get_path_date_time, get_report_path and need to be the same ()
|
# get_path_date_time, get_report_path and need to be the same
|
||||||
def get_path_date_time(self):
|
def get_path_date_time(self):
|
||||||
return self.path_date_time
|
return self.path_date_time
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
--radio 'radio==wiphy2,stations==1,ssid==TCH-XB7,ssid_pw==comcast123,security==wpa2' \
|
--radio 'radio==wiphy2,stations==1,ssid==TCH-XB7,ssid_pw==comcast123,security==wpa2' \
|
||||||
--radio 'radio==wiphy3,stations==1,ssid==TCH-XB7,ssid_pw==comcast123,security==wpa2' \
|
--radio 'radio==wiphy3,stations==1,ssid==TCH-XB7,ssid_pw==comcast123,security==wpa2' \
|
||||||
--radio 'radio==wiphy4,stations==1,ssid==TCH-XB7,ssid_pw==comcast123,security==wpa2' \
|
--radio 'radio==wiphy4,stations==1,ssid==TCH-XB7,ssid_pw==comcast123,security==wpa2' \
|
||||||
--endp_type lf_udp --ap_read --side_a_min_bps=20000 --side_b_min_bps=400000000 \
|
--endp_type lf_udp --ap_read --ap_stats --side_a_min_bps=20000 --side_b_min_bps=400000000 \
|
||||||
--attenuators 1.1.<serial number>.1 \
|
--attenuators 1.1.<serial number>.1 \
|
||||||
--atten_vals 20,21,40,41
|
--atten_vals 20,21,40,41
|
||||||
|
|
||||||
@@ -104,6 +104,7 @@ class L3VariableTime(Realm):
|
|||||||
lfclient_port=8080,
|
lfclient_port=8080,
|
||||||
debug=False,
|
debug=False,
|
||||||
influxdb=None,
|
influxdb=None,
|
||||||
|
ap_scheduler_stats=False,
|
||||||
ap_read=False,
|
ap_read=False,
|
||||||
ap_port='/dev/ttyUSB0',
|
ap_port='/dev/ttyUSB0',
|
||||||
ap_baud='115200',
|
ap_baud='115200',
|
||||||
@@ -184,11 +185,14 @@ class L3VariableTime(Realm):
|
|||||||
self.cx_profile.side_b_min_bps = side_b_min_rate[0]
|
self.cx_profile.side_b_min_bps = side_b_min_rate[0]
|
||||||
self.cx_profile.side_b_max_bps = side_b_max_rate[0]
|
self.cx_profile.side_b_max_bps = side_b_max_rate[0]
|
||||||
|
|
||||||
|
self.ap_scheduler_stats = ap_scheduler_stats
|
||||||
self.ap_read = ap_read
|
self.ap_read = ap_read
|
||||||
self.ap_port = ap_port
|
self.ap_port = ap_port
|
||||||
self.ap_baud = ap_baud
|
self.ap_baud = ap_baud
|
||||||
self.ap_cmd = ap_cmd
|
self.ap_cmd = ap_cmd
|
||||||
self.ap_test_mode = ap_test_mode
|
self.ap_test_mode = ap_test_mode
|
||||||
|
self.ap_umsched = ""
|
||||||
|
self.ap_msched = ""
|
||||||
|
|
||||||
# Lookup key is port-eid name
|
# Lookup key is port-eid name
|
||||||
self.port_csv_files = {}
|
self.port_csv_files = {}
|
||||||
@@ -237,6 +241,12 @@ class L3VariableTime(Realm):
|
|||||||
self.cx_profile.port = self.lfclient_port
|
self.cx_profile.port = self.lfclient_port
|
||||||
self.cx_profile.name_prefix = self.name_prefix
|
self.cx_profile.name_prefix = self.name_prefix
|
||||||
|
|
||||||
|
def get_ap_umsched(self):
|
||||||
|
return self.ap_umsched
|
||||||
|
|
||||||
|
def get_ap_msched(self):
|
||||||
|
return self.ap_msched
|
||||||
|
|
||||||
def get_kpi_csv(self):
|
def get_kpi_csv(self):
|
||||||
#print("self.csv_kpi_file {}".format(self.csv_kpi_file.name))
|
#print("self.csv_kpi_file {}".format(self.csv_kpi_file.name))
|
||||||
return self.csv_kpi_file.name
|
return self.csv_kpi_file.name
|
||||||
@@ -423,6 +433,21 @@ class L3VariableTime(Realm):
|
|||||||
else:
|
else:
|
||||||
self._pass("PASS: Stations & CX build finished: created/updated: %s stations and %s connections."%(self.station_count, self.cx_count))
|
self._pass("PASS: Stations & CX build finished: created/updated: %s stations and %s connections."%(self.station_count, self.cx_count))
|
||||||
|
|
||||||
|
def ap_custom_cmd(self,ap_custom_cmd):
|
||||||
|
ap_results = ""
|
||||||
|
try:
|
||||||
|
# configure the serial interface
|
||||||
|
ser = serial.Serial(self.ap_port, int(self.ap_baud), timeout=5)
|
||||||
|
ss = SerialSpawn(ser)
|
||||||
|
ss.sendline(str(ap_custom_cmd))
|
||||||
|
ss.expect([pexpect.TIMEOUT], timeout=1) # do not detete line, waits for output
|
||||||
|
ap_results = ss.before.decode('utf-8','ignore')
|
||||||
|
print("ap_custom_cmd: {} ap_results {}".format(ap_custom_cmd, ap_results))
|
||||||
|
except:
|
||||||
|
print("ap_custom_cmd: {} WARNING unable to read AP ".format(ap_custom_cmd))
|
||||||
|
|
||||||
|
return ap_results
|
||||||
|
|
||||||
def read_ap_stats(self):
|
def read_ap_stats(self):
|
||||||
# 5ghz: wl -i wl1 bs_data 2.4ghz# wl -i wl0 bs_data
|
# 5ghz: wl -i wl1 bs_data 2.4ghz# wl -i wl0 bs_data
|
||||||
ap_stats = ""
|
ap_stats = ""
|
||||||
@@ -511,6 +536,9 @@ class L3VariableTime(Realm):
|
|||||||
# Update connections with the new rate and pdu size config.
|
# Update connections with the new rate and pdu size config.
|
||||||
self.build(rebuild=True)
|
self.build(rebuild=True)
|
||||||
|
|
||||||
|
if self.ap_scheduler_stats:
|
||||||
|
self.ap_custom_cmd('wl -i wl1 dump_clear')
|
||||||
|
|
||||||
for atten_val in self.atten_vals:
|
for atten_val in self.atten_vals:
|
||||||
if atten_val != -1:
|
if atten_val != -1:
|
||||||
for atten_idx in self.attenuators:
|
for atten_idx in self.attenuators:
|
||||||
@@ -540,8 +568,6 @@ class L3VariableTime(Realm):
|
|||||||
ap_row = []
|
ap_row = []
|
||||||
ap_stats_col_titles = []
|
ap_stats_col_titles = []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while cur_time < end_time:
|
while cur_time < end_time:
|
||||||
#interval_time = cur_time + datetime.timedelta(seconds=5)
|
#interval_time = cur_time + datetime.timedelta(seconds=5)
|
||||||
interval_time = cur_time + datetime.timedelta(seconds=self.polling_interval_seconds)
|
interval_time = cur_time + datetime.timedelta(seconds=self.polling_interval_seconds)
|
||||||
@@ -637,6 +663,14 @@ class L3VariableTime(Realm):
|
|||||||
# At end of test step, record KPI information.
|
# At end of test step, record KPI information.
|
||||||
self.record_kpi(len(temp_stations_list), ul, dl, ul_pdu_str, dl_pdu_str, atten_val, total_dl_bps, total_ul_bps)
|
self.record_kpi(len(temp_stations_list), ul, dl, ul_pdu_str, dl_pdu_str, atten_val, total_dl_bps, total_ul_bps)
|
||||||
|
|
||||||
|
# At end of test if requested store upload and download stats
|
||||||
|
if self.ap_scheduler_stats:
|
||||||
|
# get the (UL) Upload scheduler statistics
|
||||||
|
self.ap_umsched = self.ap_custom_cmd('wl -i wl1 dump umsched')
|
||||||
|
# get the (DL) Download schduler staticstics
|
||||||
|
self.ap_msched = self.ap_custom_cmd('wl -i wl1 dump msched')
|
||||||
|
|
||||||
|
|
||||||
# Stop connections.
|
# Stop connections.
|
||||||
self.cx_profile.stop_cx();
|
self.cx_profile.stop_cx();
|
||||||
self.multicast_profile.stop_mc();
|
self.multicast_profile.stop_mc();
|
||||||
@@ -911,6 +945,8 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m
|
|||||||
parser.add_argument('--ap_port', help='--ap_port \'/dev/ttyUSB0\'',default='/dev/ttyUSB0')
|
parser.add_argument('--ap_port', help='--ap_port \'/dev/ttyUSB0\'',default='/dev/ttyUSB0')
|
||||||
parser.add_argument('--ap_baud', help='--ap_baud \'115200\'',default='115200')
|
parser.add_argument('--ap_baud', help='--ap_baud \'115200\'',default='115200')
|
||||||
parser.add_argument('--ap_cmd', help='ap_cmd \'wl -i wl1 bs_data\'', default="wl -i wl1 bs_data")
|
parser.add_argument('--ap_cmd', help='ap_cmd \'wl -i wl1 bs_data\'', default="wl -i wl1 bs_data")
|
||||||
|
parser.add_argument('--ap_scheduler_stats', help='--ap_scheduler_stats flag to clear stats run test then dump ul and dl stats to file on ap', action='store_true')
|
||||||
|
|
||||||
|
|
||||||
parser.add_argument('--ap_test_mode', help='ap_test_mode flag present use ap canned data', action='store_true')
|
parser.add_argument('--ap_test_mode', help='ap_test_mode flag present use ap canned data', action='store_true')
|
||||||
|
|
||||||
@@ -949,6 +985,12 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m
|
|||||||
else:
|
else:
|
||||||
ap_read = False
|
ap_read = False
|
||||||
|
|
||||||
|
if args.ap_scheduler_stats:
|
||||||
|
ap_scheduler_stats = args.ap_scheduler_stats
|
||||||
|
else:
|
||||||
|
ap_scheduler_stats = False
|
||||||
|
|
||||||
|
|
||||||
if args.ap_test_mode:
|
if args.ap_test_mode:
|
||||||
ap_test_mode = args.ap_test_mode
|
ap_test_mode = args.ap_test_mode
|
||||||
else:
|
else:
|
||||||
@@ -1126,6 +1168,7 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m
|
|||||||
lfclient_port=lfjson_port,
|
lfclient_port=lfjson_port,
|
||||||
debug=debug,
|
debug=debug,
|
||||||
influxdb=influxdb,
|
influxdb=influxdb,
|
||||||
|
ap_scheduler_stats=ap_scheduler_stats,
|
||||||
ap_read=ap_read,
|
ap_read=ap_read,
|
||||||
ap_port=ap_port,
|
ap_port=ap_port,
|
||||||
ap_baud=ap_baud,
|
ap_baud=ap_baud,
|
||||||
@@ -1163,6 +1206,25 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m
|
|||||||
#report.write_pdf(_page_size = 'A3', _orientation='Landscape')
|
#report.write_pdf(_page_size = 'A3', _orientation='Landscape')
|
||||||
report.write_pdf_with_timestamp(_page_size = 'A4', _orientation='Portrait')
|
report.write_pdf_with_timestamp(_page_size = 'A4', _orientation='Portrait')
|
||||||
|
|
||||||
|
# ap scheduler results and write to a file
|
||||||
|
if ap_scheduler_stats:
|
||||||
|
print("getting umsched and msched ap data and writing to a file")
|
||||||
|
file_date = report.get_date()
|
||||||
|
|
||||||
|
ap_umsched_data = ip_var_test.get_ap_umsched()
|
||||||
|
ap_umsched = "{}-{}".format(file_date,"ap_umsched.txt")
|
||||||
|
ap_umsched = report.file_add_path(ap_umsched)
|
||||||
|
ap_umsched_file = open(ap_umsched, "w")
|
||||||
|
ap_umsched_file.write(str(ap_umsched_data))
|
||||||
|
ap_umsched_file.close()
|
||||||
|
|
||||||
|
ap_msched_data = ip_var_test.get_ap_msched()
|
||||||
|
ap_msched = report.file_add_path("ap_msched.txt")
|
||||||
|
ap_msched = report.file_add_path(ap_msched)
|
||||||
|
ap_msched_file = open(ap_msched, "w")
|
||||||
|
ap_msched_file.write(str(ap_msched_data))
|
||||||
|
ap_msched_file.close()
|
||||||
|
|
||||||
#for csv_file in csv_list:
|
#for csv_file in csv_list:
|
||||||
# print("Ouptput reports CSV list value: {}".format(str(csv_file)))
|
# print("Ouptput reports CSV list value: {}".format(str(csv_file)))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user