mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 18:58:01 +00:00 
			
		
		
		
	CSVReader splits on tabs, not commas, and replace NaN with 0x0 in csv file swhen reporting to influx
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
		| @@ -30,7 +30,7 @@ import shutil | |||||||
| class CSVReader: | class CSVReader: | ||||||
|     def read_csv(self, |     def read_csv(self, | ||||||
|                  file, |                  file, | ||||||
|                  sep=','): |                  sep='\t'): | ||||||
|         df = open(file).read().split('\n') |         df = open(file).read().split('\n') | ||||||
|         rows = list() |         rows = list() | ||||||
|         for x in df: |         for x in df: | ||||||
|   | |||||||
| @@ -69,7 +69,10 @@ class CSVtoInflux(): | |||||||
|             tags = dict() |             tags = dict() | ||||||
|             print("row: %s" % row) |             print("row: %s" % row) | ||||||
|             short_description = row[columns['short-description']] |             short_description = row[columns['short-description']] | ||||||
|             numeric_score = float(row[columns['numeric-score']]) |             if row[columns['numeric-score']] == 'NaN': | ||||||
|  |                 numeric_score = '0x0' | ||||||
|  |             else: | ||||||
|  |                 numeric_score = float(row[columns['numeric-score']]) | ||||||
|             date = row[columns['Date']] |             date = row[columns['Date']] | ||||||
|             date = datetime.datetime.utcfromtimestamp(int(date) / 1000).isoformat() #convert to datetime so influx can read it, this is required |             date = datetime.datetime.utcfromtimestamp(int(date) / 1000).isoformat() #convert to datetime so influx can read it, this is required | ||||||
|             for variable in csv_variables: |             for variable in csv_variables: | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|         "lf_mgr_port": "8080", |         "lf_mgr_port": "8080", | ||||||
|         "dut_name": "Ruckus-R750", |         "dut_name": "Ruckus-R750", | ||||||
|         "dut_bssid": "4c:b1:cd:18:e8:ec", |         "dut_bssid": "4c:b1:cd:18:e8:ec", | ||||||
|         "test_timeout": 200, |         "test_timeout": 1200, | ||||||
|         "load_blank_db": false, |         "load_blank_db": false, | ||||||
|         "load_factory_default_db": true, |         "load_factory_default_db": true, | ||||||
|         "load_custom_db": false, |         "load_custom_db": false, | ||||||
| @@ -101,8 +101,10 @@ | |||||||
|                     " --instance_name ap-auto-instance --config_name test_con --upstream 1.1.eth1", |                     " --instance_name ap-auto-instance --config_name test_con --upstream 1.1.eth1", | ||||||
|                     " --dut5_0 'DUT_NAME lanforge DUT_BSSID (1)' --dut2_0 'DUT_NAME lanforge DUT_BSSID (1)'", |                     " --dut5_0 'DUT_NAME lanforge DUT_BSSID (1)' --dut2_0 'DUT_NAME lanforge DUT_BSSID (1)'", | ||||||
|                     " --max_stations_2 32 --max_stations_5 32 --max_stations_dual 100 --radio2 1.1.wiphy1", |                     " --max_stations_2 32 --max_stations_5 32 --max_stations_dual 100 --radio2 1.1.wiphy1", | ||||||
|                     " --radio5 1.1.wiphy2 --set 'Basic Client Connectivity' 1", |                     " --radio5 1.1.wiphy2 --set 'Basic Client Connectivity' 0", | ||||||
|                     " --set 'Multi Band Performance' 1 --set 'Skip 2.4 Ghz Tests' 1 --pull_report --local_lf_report_dir REPORT_PATH", |                     " --set 'Multi Band Performance' 1 --set 'Stability' 0 --set 'Multi-Station Throughput vs Pkt Size'  0,", | ||||||
|  |                     " --set 'Throughput vs Pkt Size' 0 --set 'Capacity' 0 --set 'Band-Steering' 0 --set 'Skip 2.4 Ghz Tests' 1", | ||||||
|  |                     " --pull_report --local_lf_report_dir REPORT_PATH", | ||||||
|                     " --test_rig TEST_RIG --influx_host DATABASE_HOST --influx_port DATABASE_PORT --influx_org DATABASE_ORG", |                     " --test_rig TEST_RIG --influx_host DATABASE_HOST --influx_port DATABASE_PORT --influx_org DATABASE_ORG", | ||||||
|                     " --influx_token=DATABASE_TOKEN --influx_bucket DATABASE_BUCKET --influx_tag DATABASE_TAG --set DUT_SET_NAME" |                     " --influx_token=DATABASE_TOKEN --influx_bucket DATABASE_BUCKET --influx_tag DATABASE_TAG --set DUT_SET_NAME" | ||||||
|                 ] |                 ] | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Matthew Stidham
					Matthew Stidham