11#!/usr/bin/env python3
2- """
2+ r """
33 NAME: lf_interop_throughput.py
44
55 PURPOSE: lf_interop_throughput.py will provide the available devices and allows user to run the wifi capacity test
@@ -240,7 +240,6 @@ def __init__(self,
240240 def os_type (self ):
241241 """
242242 Determines OS type of selected devices.
243-
244243 """
245244 response = self .json_get ("/resource/all" )
246245 if "resources" not in response .keys ():
@@ -498,6 +497,9 @@ def build(self):
498497 return self .cx_profile .created_cx
499498
500499 def create_cx (self ):
500+ '''
501+ Creates a connection profile.
502+ '''
501503 direction = ''
502504
503505 # Determine direction based on side_a_min_bps and side_b_min_bps
@@ -582,6 +584,9 @@ def start_specific(self, cx_list):
582584 # self.cx_profile.start_cx_specific(cx_list)
583585
584586 def stop_specific (self , cx_list ):
587+ '''
588+ Stops specific connections from the given list.
589+ '''
585590 logger .info ("Stopping specific CXs..." )
586591 for cx_name in cx_list :
587592 if self .debug :
@@ -593,14 +598,22 @@ def stop_specific(self, cx_list):
593598 }, debug_ = self .debug )
594599
595600 def stop (self ):
596-
601+ '''
602+ Stops all connections
603+ '''
597604 self .cx_profile .stop_cx ()
598605 self .station_profile .admin_down ()
599606
600607 def pre_cleanup (self ):
608+ '''
609+ Pre-cleanup function
610+ '''
601611 self .cx_profile .cleanup ()
602612
603613 def cleanup (self ):
614+ '''
615+ Cleanup function
616+ '''
604617 logger .info ("cleanup done" )
605618 self .cx_profile .cleanup ()
606619
@@ -618,6 +631,9 @@ def get_cx_states(self, device_names):
618631 return cx_state_list
619632
620633 def monitor (self , iteration , individual_df , device_names , incremental_capacity_list , overall_start_time , overall_end_time ):
634+ '''
635+ Monitor the performance of the devices
636+ '''
621637
622638 throughput , upload , download , upload_throughput , download_throughput , connections_upload , connections_download = {}, [], [], [], [], {}, {}
623639 drop_a , drop_a_per , drop_b , drop_b_per , state , state_of_device = [], [], [], [], [], [] # noqa: F841
@@ -637,7 +653,7 @@ def monitor(self, iteration, individual_df, device_names, incremental_capacity_l
637653 connections_download_realtime = dict .fromkeys (list (self .cx_profile .created_cx .keys ()), float (0 ))
638654
639655 logger .info ("Waiting for cx to start" )
640-
656+
641657 # loop to get_cx_states until one return 'Running'
642658 cx_states_down = True
643659 while cx_states_down :
@@ -660,9 +676,6 @@ def monitor(self, iteration, individual_df, device_names, incremental_capacity_l
660676 if self .dowebgui :
661677 runtime_dir = self .result_dir
662678
663- # start_time = datetime.now()
664- # end_time = start_time + timedelta(seconds=int(self.test_duration))
665-
666679 # Continuously collect data until end time is reached
667680 while datetime .now () < end_time :
668681 index += 1
@@ -937,7 +950,6 @@ def perform_intended_load(self, iteration, incremental_capacity_list):
937950 def check_incremental_list (self ):
938951 """
939952 Checks and generates a list of incremental capacities for connections.
940-
941953 """
942954 if (len (self .incremental_capacity ) == 0 and self .do_interopability is not True and self .incremental ):
943955 self .incremental_capacity = input ("Enter the incremental load to run the test:" )
@@ -998,9 +1010,7 @@ def check_incremental_list(self):
9981010
9991011 def get_incremental_capacity_list (self ):
10001012 """
1001-
10021013 Generates lists of incremental capacities and connection names for the created connections.
1003-
10041014 """
10051015
10061016 cx_incremental_capacity_lists , cx_incremental_capacity_names_lists , incremental_capacity_list_values = [], [], []
@@ -1060,6 +1070,9 @@ def get_incremental_capacity_list(self):
10601070
10611071 def generate_report (self , iterations_before_test_stopped_by_user , incremental_capacity_list , data = None , data1 = None , report_path = '' , result_dir_name = 'Throughput_Test_report' ,
10621072 selected_real_clients_names = None ):
1073+ '''
1074+ Generate a report for the throughput test.
1075+ '''
10631076
10641077 if self .do_interopability :
10651078 result_dir_name = "Interopability_Test_report"
@@ -1730,6 +1743,10 @@ def generate_report(self, iterations_before_test_stopped_by_user, incremental_ca
17301743 report .write_pdf ()
17311744
17321745 def trim_data (self , array_size , to_updated_array ):
1746+ '''
1747+ Trim the data to the size of array_size
1748+ '''
1749+
17331750 if array_size < 6 :
17341751 updated_array = to_updated_array
17351752 else :
@@ -1742,6 +1759,10 @@ def trim_data(self, array_size, to_updated_array):
17421759
17431760
17441761def parse_args ():
1762+ '''
1763+ Parse CLI arguments and categorize
1764+ '''
1765+
17451766 parser = argparse .ArgumentParser (
17461767 prog = "lf_interop_throughputput.py" ,
17471768 formatter_class = argparse .RawTextHelpFormatter ,
@@ -1884,7 +1905,10 @@ def parse_args():
18841905
18851906
18861907def validate_args (args ):
1887- '''Validate CLI arguments.'''
1908+ '''
1909+ Validate Required CLI arguments
1910+ '''
1911+
18881912 missed_args = []
18891913
18901914 if args .mgr is None :
0 commit comments