mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-30 18:27:53 +00:00 
			
		
		
		
	fix timestamp errors
This commit is contained in:
		| @@ -1116,7 +1116,9 @@ class L3CXProfile(LFCliBase): | ||||
|         passes = 0 | ||||
|         expected_passes = 0 | ||||
|         old_cx_rx_values = self.__get_rx_values() | ||||
|         timestamps=[] | ||||
|         while datetime.datetime.now() < end_time: | ||||
|             timepoints.append(datetime.datetime.now()) | ||||
|             response = self.json_get("/endp/%s?fields=%s" % (created_cx, fields), debug_=self.debug) | ||||
|             if "endpoint" not in response: | ||||
|                 print(response) | ||||
| @@ -1152,15 +1154,12 @@ class L3CXProfile(LFCliBase): | ||||
|         for y in range(0, len(endpoints)): | ||||
|             for x in range(0, len(endpoints[0])): | ||||
|                 endpoints2.append(list(list(endpoints[y][x].values())[0].values())) | ||||
|         timestamps=[] | ||||
|         for timestamp in [*value_map.keys()]: | ||||
|             timestamps.extend([str(timestamp)]*2*len(created_cx)) | ||||
|         for point in range(0, len(endpoints2)): | ||||
|             endpoints2[point].insert(0, timestamps[point]) | ||||
|         #step 4 save and close | ||||
|         header_row=col_names | ||||
|         header_row.insert(0,'Timestamp') | ||||
|         if output_format.lower() in ['excel','xlsx'] or report_file.split('.')[-1] is 'xlsx': | ||||
|         if output_format.lower() in ['excel','xlsx'] or report_file.split('.')[-1] == 'xlsx': | ||||
|             report_fh = open(report_file, "w+") | ||||
|             workbook = xlsxwriter.Workbook(report_file) | ||||
|             worksheet = workbook.add_worksheet() | ||||
| @@ -1200,7 +1199,11 @@ class L3CXProfile(LFCliBase): | ||||
|             if output_format == 'png': | ||||
|                 fig=df.plot().get_figure() | ||||
|                 fig.savefig(report_file) | ||||
|             supported_formats = ['csv','json','html','stata','pickle'] | ||||
|             if output_format == 'html': | ||||
|                 print('Shivams function') | ||||
|             if output_format == 'df': | ||||
|                 return df | ||||
|             supported_formats = ['csv','json','stata','pickle'] | ||||
|             for x in supported_formats: | ||||
|                 if output_format.lower() == x or report_file.split('.')[-1] == x: | ||||
|                     exec('df.to_'+x+'("'+report_file+'")') | ||||
| @@ -1848,7 +1851,12 @@ class WifiMonitor: | ||||
|                # "sniff_port 1 %s %s NA %s %s.pcap %i"%(r, m, sflags, m, int(dur)) | ||||
|  | ||||
| class VAPProfile(LFCliBase): | ||||
|     def __init__(self, lfclient_host, lfclient_port, local_realm, vap_name="", ssid="NA", ssid_pass="NA", mode=0, debug_=False): | ||||
|     def __init__(self, lfclient_host, lfclient_port, local_realm, | ||||
|                  vap_name="", | ||||
|                  ssid="NA", | ||||
|                  ssid_pass="NA", | ||||
|                  mode=0, | ||||
|                  debug_=False): | ||||
|         super().__init__(_lfjson_host=lfclient_host, _lfjson_port=lfclient_port, _debug=debug_) | ||||
|         self.debug = debug_ | ||||
|         #self.lfclient_url = lfclient_url # done in super() | ||||
| @@ -2843,8 +2851,9 @@ class MACVLANProfile(LFCliBase): | ||||
|         print(self.created_macvlans) | ||||
|         for port_eid in self.created_macvlans: | ||||
|             self.local_realm.rm_port(port_eid, check_exists=True) | ||||
|             time.sleep(.2) | ||||
|             time.sleep(.02) | ||||
|         # And now see if they are gone | ||||
|         LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url, port_list=self.created_macvlans) | ||||
|  | ||||
|  | ||||
|     def admin_up(self): | ||||
|   | ||||
| @@ -33,6 +33,7 @@ class CreateStation(Realm): | ||||
|                  _radio="wiphy0", | ||||
|                  _proxy_str=None, | ||||
|                  _debug_on=False, | ||||
|                  _up=True, | ||||
|                  _exit_on_error=False, | ||||
|                  _exit_on_fail=False): | ||||
|         super().__init__(_host, | ||||
| @@ -47,6 +48,7 @@ class CreateStation(Realm): | ||||
|         self.timeout = 120 | ||||
|         self.number_template = _number_template | ||||
|         self.debug = _debug_on | ||||
|         self.up = _up | ||||
|         self.station_profile = self.new_station_profile() | ||||
|         self.station_profile.lfclient_url = self.lfclient_url | ||||
|         self.station_profile.ssid = self.ssid | ||||
| @@ -70,6 +72,9 @@ class CreateStation(Realm): | ||||
|         self.station_profile.set_command_param("set_port", "report_timer", 1500) | ||||
|         self.station_profile.set_command_flag("set_port", "rpt_timer", 1) | ||||
|         self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug) | ||||
|         if self.up: | ||||
|             self.station_profile.admin_up() | ||||
|  | ||||
|         self._pass("PASS: Station build finished") | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Matthew Stidham
					Matthew Stidham