mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-04 04:38:02 +00:00 
			
		
		
		
	lf_kpi_csv.py added comment to use the default columns.
lf_kpi_csv.py added exception and traceback Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
		
				
					committed by
					
						
						shivam
					
				
			
			
				
	
			
			
			
						parent
						
							5d27cc8a3d
						
					
				
				
					commit
					354e545b85
				
			@@ -1,4 +1,5 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
NAME: lf_kpi_csv.py
 | 
			
		||||
 | 
			
		||||
@@ -23,6 +24,7 @@ INCLUDE_IN_README
 | 
			
		||||
import csv
 | 
			
		||||
import time
 | 
			
		||||
import argparse
 | 
			
		||||
import traceback
 | 
			
		||||
 | 
			
		||||
'''
 | 
			
		||||
Note teh delimiter for the kpi.csv is a tab
 | 
			
		||||
@@ -49,6 +51,8 @@ A blank entry is a valid entry in some cases.
 | 
			
		||||
'''
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# NOTE, Passing in _kpi_headers only used for testing.
 | 
			
		||||
# Do Not pass in headers , Please use the defaults
 | 
			
		||||
class lf_kpi_csv:
 | 
			
		||||
    def __init__(self,
 | 
			
		||||
                # NOTE, Passing in _kpi_headers only used for testing.
 | 
			
		||||
@@ -93,8 +97,9 @@ class lf_kpi_csv:
 | 
			
		||||
            self.kpi_file = open(kpifile, 'w')
 | 
			
		||||
            self.kpi_writer = csv.DictWriter(self.kpi_file, delimiter="\t", fieldnames=self.kpi_headers)
 | 
			
		||||
            self.kpi_writer.writeheader()
 | 
			
		||||
        except:
 | 
			
		||||
        except Exception as x:
 | 
			
		||||
            print("lf_kpi_csv.py: {} WARNING unable to open".format(self.kpi_file))
 | 
			
		||||
            traceback.print_exception(Exception, x, x.__traceback__, chain=True)
 | 
			
		||||
 | 
			
		||||
        self.kpi_dict = dict()
 | 
			
		||||
        self.kpi_dict['Date'] = '{date}'.format(date=int(time.time()))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user